['Pending', 'Draft'] ); } protected function filterComplete(&$result) { $result['whereClause'][] = array( 'status' => 'Complete' ); } protected function accessOnlyOwn(&$result) { $this->addLeftJoin(['campaign', 'campaignAccess'], $result); $result['whereClause'][] = array( 'campaignAccess.assignedUserId' => $this->getUser()->id ); } protected function accessOnlyTeam(&$result) { $this->addLeftJoin(['campaign', 'campaignAccess'], $result); $teamIdList = $this->user->getLinkMultipleIdList('teams'); if (empty($result['customWhere'])) { $result['customWhere'] = ''; } if (empty($teamIdList)) { $result['customWhere'] .= " AND campaignAccess.assigned_user_id = ".$this->getEntityManager()->getPDO()->quote($this->getUser()->id); return; } $arr = []; if (is_array($teamIdList)) { foreach ($teamIdList as $teamId) { $arr[] = $this->getEntityManager()->getPDO()->quote($teamId); } } $result['customJoin'] .= " LEFT JOIN entity_team AS teamsMiddle ON teamsMiddle.entity_type = 'Campaign' AND teamsMiddle.entity_id = campaignAccess.id AND teamsMiddle.deleted = 0"; $result['customWhere'] .= " AND ( teamsMiddle.team_id IN (" . implode(', ', $arr) . ") OR campaignAccess.assigned_user_id = ".$this->getEntityManager()->getPDO()->quote($this->getUser()->id)." ) "; $result['whereClause'][] = array( 'campaignId!=' => null ); } }