. // }}} namespace Component\Circle\Controller; use function App\Core\I18n\_m; use App\Entity\LocalUser; use App\Util\Exception\ClientException; use Component\Circle\Entity\ActorCircle; use Component\Collection\Util\Controller\CircleController; class Circle extends CircleController { public function circleById(int|ActorCircle $circle_id): array { $circle = \is_int($circle_id) ? ActorCircle::getByPK(['id' => $circle_id]) : $circle_id; unset($circle_id); if (\is_null($circle)) { throw new ClientException(_m('No such circle.'), 404); } else { return [ '_template' => 'collection/actors.html.twig', 'title' => _m('Circle'), 'empty_message' => _m('No members.'), 'sort_form_fields' => [], 'page' => $this->int('page') ?? 1, 'actors' => $circle->getTaggedActors(), ]; } } public function circleByTaggerIdAndTag(int $tagger_id, string $tag): array { return $this->circleById(ActorCircle::getByPK(['tagger' => $tagger_id, 'tag' => $tag])); } public function circleByTaggerNicknameAndTag(string $tagger_nickname, string $tag): array { return $this->circleById(ActorCircle::getByPK(['tagger' => LocalUser::getByNickname($tagger_nickname)->getId(), 'tag' => $tag])); } }