/** * @param $membershipEntity Entity whose members we want to view * @param $id User ID * @return User */ public function getItem(MembershipEntityInterface $membershipEntity, $id) { $this->transaction->requestTransaction(); try { $user = User::fetchLinkedProfile($this->conn, $this->roleResolver, $membershipEntity, Join::create($this->membershipTable(), 'm', QueryClause::clause('m.userId = u.id')), QueryOperator::op('AND')->expr(QueryClause::clause('m.' . $this->entityColumn() . ' = :entityId', ':entityId', $membershipEntity->getId()))->expr(QueryClause::clause('u.`id` = :userId', ':userId', $id))); if (false === $user) { throw new ItemNotFoundException('The specified user has not been found.'); } return $user; } catch (Exception $exception) { $this->transaction->requestRollback(); throw $exception; } }
public function findMember(Connection $conn, MembershipRoleResolver $resolver, $id) { return User::fetchLinkedProfile($conn, $resolver, $this, Join::create(CoreTables::AREA_MEMBER_TBL, 'm', QueryClause::clause('m.`userId` = u.`id`')), QueryClause::clause('u.`id` = :id', ':id', $id)); }