Why am I getting errors when trying to run this:
if($queryFilters['status_id'] == '' ){$queryFilters['status_id'] = 2;}
$mygroups = $this->getGroupMemberships();
$criteria = $this->modx->newQuery('FundRequest');
$criteria->where($queryFilters);
$criteria->andCondition(array('Program.location_id:IN' => $mygroups));
$criteria->sortby('`FundRequest`.`request_date`','desc');
$fundRequests = $this->modx->getCollectionGraph('FundRequest', '{ "StatusFlag":{}, "PaymentMethod":{}, "Contract":{ "Client": {}, }, "Program": { "Location": {}, } }', $criteria);
$criteria->prepare();
echo '<pre>'.$criteria->toSQL().'</pre>';
I get a "Unknown column 'Program.location_id' in 'where clause'"
If I run:
echo $fundRequest->Program->Location->get('location').'<br>';
Without the $criteria->andCondition(array('Program.location_id:IN' => $mygroups)); I get correct results, so I know the schema is correct.
If I grab the sql output, I can see that the Program table has not been joined.
What is the correct way of joining a table in the $criteria for a call to getCollectionGraph?