context = DatabaseConnection::i()->getContext(); $this->contacts = $this->context->table("group_contacts"); } function get(int $id): ?Contact { $ar = $this->clubs->get($id); return is_null($ar) ? NULL : new Contact($ar); } function getByClub(int $id): \Traversable { $contacts = $this->contacts->where("group", $id)->where("deleted", 0); return new Util\EntityStream("Contact", $contacts); } function getByClubAndUser(int $club, int $user): ?Contact { $contact = $this->contacts->where("group", $club)->where("user", $user)->fetch(); return $this->get($contact); } }