diff --git a/src/Bundle/ChillPersonBundle/config/services.yaml b/src/Bundle/ChillPersonBundle/config/services.yaml index 72b732777..921e02576 100644 --- a/src/Bundle/ChillPersonBundle/config/services.yaml +++ b/src/Bundle/ChillPersonBundle/config/services.yaml @@ -1,27 +1,45 @@ services: - chill.person.form.type.select2maritalstatus: - class: Chill\PersonBundle\Form\Type\Select2MaritalStatusType - arguments: - - "@request_stack" - - "@doctrine.orm.entity_manager" - tags: - - { name: form.type, alias: select2_chill_marital_status } + _defaults: + autowire: true # Automatically injects dependencies in your services. + autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. - chill.person.timeline.accompanying_period_opening: - class: Chill\PersonBundle\Timeline\TimelineAccompanyingPeriodOpening - arguments: - - "@doctrine.orm.entity_manager" - public: true - tags: - - { name: chill.timeline, context: 'person' } + # makes classes in src/ available to be used as services + # this creates a service per class whose id is the fully-qualified class name + Chill\PersonBundle\: + resource: '../src/' + exclude: + - '../src/DependencyInjection/' + - '../src/Entity/' + - '../src/Kernel.php' + - '../src/Tests/' - chill.person.timeline.accompanying_period_closing: - class: Chill\PersonBundle\Timeline\TimelineAccompanyingPeriodClosing - arguments: - - "@doctrine.orm.entity_manager" - public: true + Chill\PersonBundle\Form\Type\: + resource: '../src/Form/Type/' tags: - - { name: chill.timeline, context: 'person' } + - { name: form.type } + + Chill\PersonBundle\Timeline\: + resource: '../src/Timeline/' + tags: + - { name: chill.timeline, context: person } + + Chill\PersonBundle\Controller\: + resource: '../src/Controller/' + tags: ['controller.service_arguments'] + + Chill\PersonBundle\Repository\: + resource: '../src/Repository/' + tags: ['doctrine.repository_service'] + + Chill\PersonBundle\Command\: + resource: '../src/Command/' + tags: + - { name: console.command } + + Chill\PersonBundle\Menu\: + resource: '../src/Menu/' + tags: + - { name: 'chill.menu_builder' } chill.person.security.authorization.person: class: Chill\PersonBundle\Security\Authorization\PersonVoter @@ -38,10 +56,3 @@ services: tags: - { name: validator.constraint_validator, alias: birthdate_not_before } - Chill\PersonBundle\Controller\: - resource: '../src/Controller/' - tags: ['controller.service_arguments'] - - Chill\PersonBundle\Repository\: - resource: '../src/Repository/' - tags: ['doctrine.repository_service'] diff --git a/src/Bundle/ChillPersonBundle/config/services/actions.yaml b/src/Bundle/ChillPersonBundle/config/services/actions.yaml deleted file mode 100644 index e4c6c6621..000000000 --- a/src/Bundle/ChillPersonBundle/config/services/actions.yaml +++ /dev/null @@ -1,5 +0,0 @@ -services: - Chill\PersonBundle\Actions\Remove\PersonMove: - arguments: - $em: '@Doctrine\ORM\EntityManagerInterface' - $eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface' \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/command.yaml b/src/Bundle/ChillPersonBundle/config/services/command.yaml index 685a348dd..83166769e 100644 --- a/src/Bundle/ChillPersonBundle/config/services/command.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/command.yaml @@ -6,14 +6,3 @@ services: $chillLogger: '@chill.main.logger' tags: - { name: console.command } - - Chill\PersonBundle\Command\ImportPeopleFromCSVCommand: - arguments: - $logger: '@logger' - $helper: '@Chill\MainBundle\Templating\TranslatableStringHelper' - $em: '@Doctrine\ORM\EntityManagerInterface' - $customFieldProvider: '@Chill\CustomFieldsBundle\Service\CustomFieldProvider' - $eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface' - $formFactory: '@form.factory' - tags: - - { name: console.command } diff --git a/src/Bundle/ChillPersonBundle/config/services/controller.yaml b/src/Bundle/ChillPersonBundle/config/services/controller.yaml deleted file mode 100644 index 4a5956dc8..000000000 --- a/src/Bundle/ChillPersonBundle/config/services/controller.yaml +++ /dev/null @@ -1,36 +0,0 @@ -services: - Chill\PersonBundle\Controller\TimelinePersonController: - arguments: - $eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface' - $timelineBuilder: '@chill_main.timeline_builder' - $paginatorFactory: '@chill_main.paginator_factory' - tags: ['controller.service_arguments'] - - Chill\PersonBundle\Controller\AccompanyingPeriodController: - arguments: - $eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface' - $validator: '@Symfony\Component\Validator\Validator\ValidatorInterface' - tags: ['controller.service_arguments'] - - Chill\PersonBundle\Controller\PersonAddressController: - arguments: - $validator: '@Symfony\Component\Validator\Validator\ValidatorInterface' - tags: ['controller.service_arguments'] - - Chill\PersonBundle\Controller\AdminController: ~ - - Chill\PersonBundle\Controller\PersonDuplicateController: - arguments: - $similarPersonMatcher: '@Chill\PersonBundle\Search\SimilarPersonMatcher' - $translator: '@Symfony\Component\Translation\TranslatorInterface' - $personRepository: '@Chill\PersonBundle\Repository\PersonRepository' - $personMove: '@Chill\PersonBundle\Actions\Remove\PersonMove' - $eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface' - tags: ['controller.service_arguments'] - - Chill\PersonBundle\Controller\AccompanyingCourseController: - arguments: - $serializer: '@Symfony\Component\Serializer\SerializerInterface' - $dispatcher: '@Symfony\Contracts\EventDispatcher\EventDispatcherInterface' - $validator: '@Symfony\Component\Validator\Validator\ValidatorInterface' - tags: ['controller.service_arguments'] diff --git a/src/Bundle/ChillPersonBundle/config/services/form.yaml b/src/Bundle/ChillPersonBundle/config/services/form.yaml index aa6f36b28..799e9d909 100644 --- a/src/Bundle/ChillPersonBundle/config/services/form.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/form.yaml @@ -32,7 +32,7 @@ services: chill.person.form.type.pick_person: class: Chill\PersonBundle\Form\Type\PickPersonType arguments: - - "@chill.person.repository.person" + - Chill\PersonBundle\Repository\PersonRepository" - "@security.token_storage" - "@chill.main.security.authorization.helper" - '@Symfony\Component\Routing\Generator\UrlGeneratorInterface' @@ -46,10 +46,3 @@ services: $translatableStringHelper: '@chill.main.helper.translatable_string' tags: - { name: form.type } - - Chill\PersonBundle\Form\Type\PersonPhoneType: - arguments: - $phonenumberHelper: '@Chill\MainBundle\Phonenumber\PhonenumberHelper' - $em: '@Doctrine\ORM\EntityManagerInterface' - tags: - - { name: form.type } diff --git a/src/Bundle/ChillPersonBundle/config/services/menu.yaml b/src/Bundle/ChillPersonBundle/config/services/menu.yaml deleted file mode 100644 index e94a81572..000000000 --- a/src/Bundle/ChillPersonBundle/config/services/menu.yaml +++ /dev/null @@ -1,26 +0,0 @@ -services: - Chill\PersonBundle\Menu\SectionMenuBuilder: - arguments: - $authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface' - $translator: '@Symfony\Component\Translation\TranslatorInterface' - tags: - - { name: 'chill.menu_builder' } - - Chill\PersonBundle\Menu\AdminMenuBuilder: - arguments: - $authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface' - tags: - - { name: 'chill.menu_builder' } - - Chill\PersonBundle\Menu\PersonMenuBuilder: - arguments: - $showAccompanyingPeriod: '%chill_person.accompanying_period%' - $translator: '@Symfony\Contracts\Translation\TranslatorInterface' - tags: - - { name: 'chill.menu_builder' } - - Chill\PersonBundle\Menu\AccompanyingCourseMenuBuilder: - arguments: - $translator: '@Symfony\Contracts\Translation\TranslatorInterface' - tags: - - { name: 'chill.menu_builder' } diff --git a/src/Bundle/ChillPersonBundle/config/services/repository.yaml b/src/Bundle/ChillPersonBundle/config/services/repository.yaml deleted file mode 100644 index e5ce06149..000000000 --- a/src/Bundle/ChillPersonBundle/config/services/repository.yaml +++ /dev/null @@ -1,7 +0,0 @@ -services: - - chill.person.repository.person: - class: Chill\PersonBundle\Repository\PersonRepository - autowire: true - autoconfigure: true - Chill\PersonBundle\Repository\PersonRepository: '@chill.person.repository.person' diff --git a/src/Bundle/ChillPersonBundle/config/services/search.yaml b/src/Bundle/ChillPersonBundle/config/services/search.yaml index 8b4db1373..bbbf46dd1 100644 --- a/src/Bundle/ChillPersonBundle/config/services/search.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/search.yaml @@ -10,7 +10,7 @@ services: - ['setContainer', ["@service_container"]] tags: - { name: chill.search, alias: 'person_regular' } - + Chill\PersonBundle\Search\SimilarityPersonSearch: arguments: - "@doctrine.orm.entity_manager" @@ -22,9 +22,3 @@ services: - ['setContainer', ["@service_container"]] tags: - { name: chill.search, alias: 'person_similarity' } - - Chill\PersonBundle\Search\SimilarPersonMatcher: - arguments: - $em: '@Doctrine\ORM\EntityManagerInterface' - $tokenStorage: '@Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface' - $authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper' diff --git a/src/Bundle/ChillPersonBundle/config/services/widgets.yaml b/src/Bundle/ChillPersonBundle/config/services/widgets.yaml index 7ea920cc2..5085d21f1 100644 --- a/src/Bundle/ChillPersonBundle/config/services/widgets.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/widgets.yaml @@ -2,13 +2,13 @@ services: chill_person.widget.person_list: class: Chill\PersonBundle\Widget\PersonListWidget arguments: - - "@chill.person.repository.person" + - Chill\PersonBundle\Repository\PersonRepository - "@doctrine.orm.entity_manager" - "@chill.main.security.authorization.helper" - "@security.token_storage" # this widget is defined by the PersonListWidgetFactory - + chill_person.widget.add_person: class: Chill\PersonBundle\Widget\AddAPersonWidget tags: - - { name: chill_widget, alias: add_person, place: homepage } \ No newline at end of file + - { name: chill_widget, alias: add_person, place: homepage } diff --git a/src/Bundle/ChillPersonBundle/src/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/src/DependencyInjection/ChillPersonExtension.php index 777dff106..5240a063c 100644 --- a/src/Bundle/ChillPersonBundle/src/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/src/DependencyInjection/ChillPersonExtension.php @@ -65,14 +65,10 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac $loader->load('services/widgets.yaml'); $loader->load('services/exports.yaml'); $loader->load('services/fixtures.yaml'); - $loader->load('services/controller.yaml'); $loader->load('services/search.yaml'); - $loader->load('services/menu.yaml'); $loader->load('services/privacyEvent.yaml'); $loader->load('services/command.yaml'); - $loader->load('services/actions.yaml'); $loader->load('services/form.yaml'); - $loader->load('services/repository.yaml'); $loader->load('services/templating.yaml'); $loader->load('services/alt_names.yaml'); $loader->load('services/serializer.yaml'); diff --git a/src/Bundle/ChillPersonBundle/src/Menu/PersonMenuBuilder.php b/src/Bundle/ChillPersonBundle/src/Menu/PersonMenuBuilder.php index b39b14254..a4f146ad4 100644 --- a/src/Bundle/ChillPersonBundle/src/Menu/PersonMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/src/Menu/PersonMenuBuilder.php @@ -19,13 +19,14 @@ namespace Chill\PersonBundle\Menu; use Chill\MainBundle\Routing\LocalMenuBuilderInterface; use Knp\Menu\MenuItem; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Contracts\Translation\TranslatorInterface; /** * Add menu entrie to person menu. - * + * * Menu entries added : - * + * * - person details ; * - accompanying period (if `visible`) * @@ -33,25 +34,23 @@ use Symfony\Contracts\Translation\TranslatorInterface; class PersonMenuBuilder implements LocalMenuBuilderInterface { /** - * * @var string 'visible' or 'hidden' */ protected $showAccompanyingPeriod; - + /** - * * @var TranslatorInterface */ protected $translator; - + public function __construct( - $showAccompanyingPeriod, + ParameterBagInterface $parameterBag, TranslatorInterface $translator ) { - $this->showAccompanyingPeriod = $showAccompanyingPeriod; + $this->showAccompanyingPeriod = $parameterBag->get('chill_person.accompanying_period'); $this->translator = $translator; } - + public function buildMenu($menuId, MenuItem $menu, array $parameters) { $menu->addChild($this->translator->trans('Person details'), [ @@ -73,7 +72,7 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface ->setExtras([ 'order' => 51 ]); - + if ($this->showAccompanyingPeriod === 'visible') { $menu->addChild($this->translator->trans('Accompanying period list'), [ 'route' => 'chill_person_accompanying_period_list',