$query = $modx->newQuery('myTable');
// $query->where(array('myTable.my_column:LIKE' => '%something%')); // <-- searching myTable works
$query->where(array('myTable.modUser.Profile.fullname:LIKE' => '%Bob%')); // <-- searching the joined table does not work :(
$my_records = $modx->getCollectionGraph('myTable', '{"modUser": {"Profile":{} } }',$query);
No. It’s just the "alias" of the related table class (in this case, for modUserProfile the alias is Profile), e.g. ’Profile.fullname:LIKE’ — there is no hierarchy preserved in the query aliases wrt the graph.
I’ve got a Snippet pulling up some records from a custom table. I’d like to be able to search for records in this table by searching for attributes that exist in a joined table. My table has a foreign key linking it to the modUser class, and that table in turn links to the Profile class.
$query = $modx->newQuery('myTable'); // $query->where(array('myTable.my_column:LIKE' => '%something%')); // <-- searching myTable works $query->where(array('myTable.modUser.Profile.fullname:LIKE' => '%Bob%')); // <-- searching the joined table does not work :( $my_records = $modx->getCollectionGraph('myTable', '{"modUser": {"Profile":{} } }',$query);
Did I do the correct syntax for the where method?
$query->where(array('Profile.fullname:LIKE' => '%Company%'));