implementation in thirdpartyType

This commit is contained in:
Julie Lenaerts 2022-02-16 16:58:37 +01:00
parent 25264447bc
commit 20104f1b3b

View File

@ -11,11 +11,11 @@ declare(strict_types=1);
namespace Chill\ThirdPartyBundle\Form;
use Chill\MainBundle\Entity\Civility;
use Chill\MainBundle\Form\Type\ChillCollectionType;
use Chill\MainBundle\Form\Type\ChillTextareaType;
use Chill\MainBundle\Form\Type\PickAddressType;
use Chill\MainBundle\Form\Type\PickCenterType;
use Chill\MainBundle\Form\Type\PickCivilityType;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
@ -101,16 +101,8 @@ class ThirdPartyType extends AbstractType
// Contact Person ThirdParty (child)
if (ThirdParty::KIND_CONTACT === $options['kind'] || ThirdParty::KIND_CHILD === $options['kind']) {
$builder
->add('civility', EntityType::class, [
->add('civility', PickCivilityType::class, [
'label' => 'thirdparty.Civility',
'class' => Civility::class,
'choice_label' => function (Civility $civility): string {
return $this->translatableStringHelper->localize($civility->getName());
},
'query_builder' => static function (EntityRepository $er): QueryBuilder {
return $er->createQueryBuilder('c')
->where('c.active = true');
},
'placeholder' => 'thirdparty.choose civility',
'required' => false,
])