We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30498
    • 30 Posts
    I have 2 external tables and combined them into a view.
    I've added the view as package into modx so it is accessable using $modx->newQuery
    To do this I used the CreateXpdoClasses snippet (i think from bobsguides)

    Worked like a charm.

    Than I had to add an extra column to one of the tables. Also added it into the view.

    I re-ran the snippet. In the new mysql.schema.xml the new column (named oneliner) is automatically added:
    <field key="oneliner" dbtype="varchar" precision="254" phptype="string" null="false" default="" />

    However, when I do:
    $oQrydeal = $modx->newQuery('Viewdeals');
    $oQrydeal->where( array('courseId'=>$iCourseid, 'deal_published'=>'Yes') ) ;
    $oQrydeal->limit(8) ;
    $oDeals = $modx->getCollection('Viewdeals', $oQrydeal) ;
    $aDeal = $oDeal->toArray() ;

    var_dump(array_key_exists('oneliner',$aDeal)) ;

    false is always returned. The new column oneliner is never there. (all the others are though)

    Im sure im missing something small. maybe some cache issue but I haven't been able to figure it out. Anyone?

    This question has been answered by BobRay. See the first response.

    [ed. note: Towila last edited this post 12 years, 7 months ago.]
      • 30498
      • 30 Posts
      Since no one seems to be able to answer the question, and I still haven't figured this one out for now I'll be solving it with a regular pdo query.

      I'd like to leave this question open though, cause I really want to know whats could be the issue here.
      • discuss.answer
        • 3749
        • 24,544 Posts
        Did you run the snippet with &createClasses=`1`? You need to not only recreate the schema, you need to regenerate the class and map files after any change to the schema.

        When you're done, delete all files in the core/cache directory.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 30498
          • 30 Posts
          Quote from: BobRay at Feb 11, 2014, 03:31 PM
          Did you run the snippet with &createClasses=`1`? You need to not only recreate the schema, you need to regenerate the class and map files after any change to the schema.

          When you're done, delete all files in the core/cache directory.

          That was it Bob. Thanks a lot!
            • 3749
            • 24,544 Posts
            Glad I could help. Thanks for reporting back. smiley
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting