We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I'm having trouble understanding how to sort and filter getCollectionGraph based on anything other than the primary key. I have another column called "created_userid", and all I want is the equivalent of a where statement that lets me show only entries that match a passed-in userid. Can anyone clarify? I'd be glad to provide my example code.

    Btw, I saw this thread...

    http://forums.modx.com/thread/31768/but-i-don-t-want-to-order-by-primary-key#dis-post-171755

    ...but it makes no sense to me and (I think) is way more complicated than what I'm trying to do:
    • Never mind -- got it! It never fails: I post on the forums, and figure it out five seconds later.

      For anyone wondering:

      $user_id = $_GET['user_id'];
        $crit = $modx->newQuery('Table1');
        $crit->where(array ('Table1.created_userid:=' => $user_id));  
        $articles = $modx->getCollectionGraph('Table1', '{ "Table2":{},"Table3":{} }', $crit);