getUser()->isAdmin() && !$this->getUser()->isApi()) { $result['whereClause'][] = [ 'id' => null ]; } if ($this->getUser()->isApi()) { $result['whereClause'][] = [ 'userId' => $this->getUser()->id ]; } } }