diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php new file mode 100644 index 000000000..e02b6e4c3 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php @@ -0,0 +1,43 @@ +personResourceRepository = $personResourceRepository; + $this->personRepository = $personRepository; + } + + public function listAction($person_id) + { + dump($person_id); + $person = $this->personRepository->find($person_id); + dump($person); + return $this->render( + 'ChillPersonBundle:PersonResource:list.html.twig', + [ + 'person' => $person + ] + ); + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Menu/PersonMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/PersonMenuBuilder.php index d83fa29dd..228309737 100644 --- a/src/Bundle/ChillPersonBundle/Menu/PersonMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/PersonMenuBuilder.php @@ -96,6 +96,16 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface 'order' => 100, ]); } + + $menu->addChild($this->translator->trans('person_resources_menu'), [ + 'route' => 'chill_person_resource_list', + 'routeParameters' => [ + 'person_id' => $parameters['person']->getId(), + ], + ]) + ->setExtras([ + 'order' => 99999, + ]); } public static function getMenuIds(): array diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonResourceRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonResourceRepository.php new file mode 100644 index 000000000..1874bec05 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Repository/PersonResourceRepository.php @@ -0,0 +1,61 @@ +repository = $entityManager->getRepository(PersonResource::class); + } + + public function find($id): ?PersonResource + { + return $this->repository->find($id); + } + + /** + * @return PersonResource[] + */ + public function findAll(): array + { + return $this->repository->findAll(); + } + + /** + * @param mixed|null $limit + * @param mixed|null $offset + * + * @return PersonResource[] + */ + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array + { + return $this->repository->findBy($criteria, $orderBy, $limit, $offset); + } + + public function findOneBy(array $criteria): ?PersonResource + { + return $this->repository->findOneBy($criteria); + } + + public function getClassName(): string + { + return PersonResource::class; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig new file mode 100644 index 000000000..8e943c43a --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig @@ -0,0 +1,32 @@ +{% extends "@ChillPerson/Person/layout.html.twig" %} + +{% set activeRouteKey = 'chill_person_resource_list' %} + +{% block title %}{{ 'Person resources'|trans|capitalize ~ ' ' ~ person|chill_entity_render_string }}{% endblock %} + +{% block personcontent %} + +{{ person }} +