We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    This getCollection() call gets the same resources if I change both instances of modDocument to modResource, but as it is here, two of the documents come up with empty ids and pagetitles. I don’t see anything different about them except that one is the current document. I don’t see anything different about the other one. Even odder, they appear at the correct point in the sort even though get() doesn’t get the id.

    <?php
    /* get all published, richtext docs created by the admin */
    $c = $modx->newQuery('modDocument');
    $c->where(array(
        'published'=>'1',
        'createdby'=>'1',
        'richtext'=>'1')
        );
    $c->sortby('id','ASC');
    $docs = $modx->getCollection('modDocument', $c);
    
    foreach ($docs as $doc) {
    
    echo $doc->get('pagetitle') . ' (' . $doc->get('id') . ')' . '<br />';
    
    }
    ?>
      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
      • 28215
      • 4,149 Posts
      Hmm, I wonder if those Resources that dont show up have their class_key in the DB being modResource instead of modDocument. Could you check that?
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 3749
        • 24,544 Posts
        Bingo.

        For the missing ones:

        type = ’document’
        class_key = ’modResource’

        For all the ones that show, class_key is set to ’modDocument’

        The culprit is Quick Create. MODX-1370: http://svn.modxcms.com/jira/browse/MODX-1370
          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