diff --git a/src/Bundle/ChillPersonBundle/config/services/form.yaml b/src/Bundle/ChillPersonBundle/config/services/form.yaml index 799e9d909..0d69ef934 100644 --- a/src/Bundle/ChillPersonBundle/config/services/form.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/form.yaml @@ -23,12 +23,6 @@ services: tags: - { name: form.type, alias: closing_motive } - Chill\PersonBundle\Form\AccompanyingPeriodType: - arguments: - $config: "%chill_person.accompanying_period_fields%" - tags: - - { name: form.type } - chill.person.form.type.pick_person: class: Chill\PersonBundle\Form\Type\PickPersonType arguments: diff --git a/src/Bundle/ChillPersonBundle/src/Controller/AccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/src/Controller/AccompanyingPeriodController.php index d7ec74bd0..ab5a38154 100644 --- a/src/Bundle/ChillPersonBundle/src/Controller/AccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/src/Controller/AccompanyingPeriodController.php @@ -26,7 +26,7 @@ use Chill\PersonBundle\Privacy\PrivacyEvent; use Doctrine\DBAL\Exception; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Chill\PersonBundle\Entity\Person; -use Chill\PersonBundle\Form\AccompanyingPeriodType; +use Chill\PersonBundle\Form\Type\AccompanyingPeriodType; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Doctrine\Common\Collections\Criteria; use Chill\PersonBundle\Security\Authorization\PersonVoter; diff --git a/src/Bundle/ChillPersonBundle/src/Form/AccompanyingPeriodType.php b/src/Bundle/ChillPersonBundle/src/Form/Type/AccompanyingPeriodType.php similarity index 91% rename from src/Bundle/ChillPersonBundle/src/Form/AccompanyingPeriodType.php rename to src/Bundle/ChillPersonBundle/src/Form/Type/AccompanyingPeriodType.php index b4c146960..9b339a086 100644 --- a/src/Bundle/ChillPersonBundle/src/Form/AccompanyingPeriodType.php +++ b/src/Bundle/ChillPersonBundle/src/Form/Type/AccompanyingPeriodType.php @@ -1,6 +1,6 @@ config = $config; + $this->config = $parameterBag->get('chill_person.accompanying_period_fields'); } - + /** * @param FormBuilderInterface $builder * @param array $options @@ -58,12 +52,12 @@ class AccompanyingPeriodType extends AbstractType ]) ; } - + // closingDate should be seen only if // period_action = close // OR ( period_action = update AND accompanying period is already closed ) $accompanyingPeriod = $options['data']; - + if ( ($options['period_action'] === 'close') OR @@ -71,16 +65,16 @@ class AccompanyingPeriodType extends AbstractType OR ($options['period_action'] === 'update' AND !$accompanyingPeriod->isOpen()) ) { - + $builder->add('closingDate', DateType::class, [ 'required' => true, 'widget' => 'single_text', 'format' => 'dd-MM-yyyy' ]); - + $builder->add('closingMotive', ClosingMotivePickerType::class); } - + if ($this->config['user'] === 'visible') { $builder->add('user', UserPickerType::class, [ 'center' => $options['center'], @@ -110,7 +104,7 @@ class AccompanyingPeriodType extends AbstractType ->setAllowedTypes('center', Center::class) ; } - + /** * @param FormView $view * @param FormInterface $form