$userClass = 'modUser'; $c = $modx->newQuery($userClass); $email = '[email protected]'; $c->where(array('Profile.email' => $email)); $users = $modx->getCollectionGraph($userClass, '{"Profile":{}', $c);
Unknown column 'Profile.email' in 'where clause'
$userClass = 'modUser';
$c = $modx->newQuery($userClass);
$c->leftJoin('modUserProfile','Profile','Profile.internalKey=modUser.id');
$email = '[email protected]';
$c->where(array('Profile.email' => $email));
$users = $modx->getCollectionGraph($userClass, '{"Profile":{}', $c);$where = array(
array(
'Data.category1:=' => $category,
'OR:Data.category2:=' => $category,
'OR:Data.category3:=' => $category,
),
);
$c = $modx->newQuery($userClass);
$c->sortby('Data.lastName', 'ASC');
$c->where($where);
$users = $modx->getCollectionGraph($userClass, '{"Profile":{},"Data":{}}', $c);
I thought with getCollectionGraph() you never have to do a join since it's done internally in the method.
$criteria = array();
$users = $modx->getCollectionGraph('modUser', '{"Profile":{}}', $criteria);
foreach( $users as $user ){
$userData = $user->toArray();
$userProfile = $user->Profile->toArray(); // User attribute data
$debug .= print_r($userData,true);
$debug .= print_r($userProfile,true);
}
die("$debug");
<?php $userClass = 'modUser'; $c = $modx->newQuery($userClass); $email = '[email protected]'; $c->where(array('Profile.email:=' => $email)); $users = $modx->getCollectionGraph($userClass, '{"Profile":{}}', $c);