Error Retrieving Express Data with a Filter Set on a User Selector Attribute - v8.5.4
Permalink
I'm fairly sure this isn't working because the attribute is of type "User Selector". Normally I can retrieve it as a number using getAttribute('coach_for_participant_id') but setting it with filterByAttribute('coach_for_participant_id', $userID, '=') always gives an error message saying "ak_coach_for_participant_id" is an unknown column
An exception occurred while executing 'SELECT e.exEntryID FROM ExpressEntityEntries e LEFT JOIN CoachExpressSearchIndexAttributes ea ON e.exEntryID = ea.exEntryID WHERE (ak_coach_for_participant_id = ?) AND (e.exEntryEntityID = ?) ORDER BY e.exEntryDateCreated desc' with params ["122", "019b2834-ca3f-11ea-84f9-c7907cba30c2"]: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'ak_coach_for_participant_id' in 'where clause'
The attribute 'coach_for_participant_id' used below is of type 'User Selector'
An exception occurred while executing 'SELECT e.exEntryID FROM ExpressEntityEntries e LEFT JOIN CoachExpressSearchIndexAttributes ea ON e.exEntryID = ea.exEntryID WHERE (ak_coach_for_participant_id = ?) AND (e.exEntryEntityID = ?) ORDER BY e.exEntryDateCreated desc' with params ["122", "019b2834-ca3f-11ea-84f9-c7907cba30c2"]: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'ak_coach_for_participant_id' in 'where clause'
The attribute 'coach_for_participant_id' used below is of type 'User Selector'
$entityF = \Express::getObjectByHandle('coach'); $entityListF = new EntryList($entityF); $entityListF->filterByAttribute('coach_for_participant_id', $userID, '='); // IF THIS LINE IS COMMENTED OUT IT WORKS $entityListF->sortByDateAddedDescending(); $entriesF = $entityListF->getResults(); // < ERROR OCCURS HERE foreach ($entriesF as $theEE) { ... $tmpUserId = $theEE->getAttribute('coach_for_participant_id'); // THIS WORKS WITH NO PROBLEMS ... }