This commit is contained in:
Julien Fastré 2022-02-21 17:30:33 +01:00
parent 3849776511
commit 775d223be2
2 changed files with 10 additions and 9 deletions

View File

@ -35,16 +35,16 @@ class PickCivilityType extends AbstractType
->setDefault( ->setDefault(
'choice_label', 'choice_label',
function (Civility $civility): string { function (Civility $civility): string {
return $this->translatableStringHelper->localize($civility->getName()); return $this->translatableStringHelper->localize($civility->getName());
} }
) )
->setDefault( ->setDefault(
'query_builder', 'query_builder',
static function (EntityRepository $er): QueryBuilder { static function (EntityRepository $er): QueryBuilder {
return $er->createQueryBuilder('c') return $er->createQueryBuilder('c')
->where('c.active = true') ->where('c.active = true')
->orderBy('c.order'); ->orderBy('c.order');
}, },
) )
->setDefault('placeholder', 'choose civility') ->setDefault('placeholder', 'choose civility')
->setDefault('class', Civility::class); ->setDefault('class', Civility::class);

View File

@ -69,12 +69,13 @@ use function spl_object_hash;
* Categories are managed in the database. The Chill administrator may create or desactivate categories. * Categories are managed in the database. The Chill administrator may create or desactivate categories.
* *
* Types are also a way to categorize the thirdparties, but this is done **into the code**, through * Types are also a way to categorize the thirdparties, but this is done **into the code**, through
* @link{Chill\ThirdPartyBundle\ThirdPartyType\ThirdPartyTypeProviderInterface}. The type is stored into the *
* @see{Chill\ThirdPartyBundle\ThirdPartyType\ThirdPartyTypeProviderInterface}. The type is stored into the
* database by a Php array, mapped by a jsonb into the database. This has one advantage: it is easily searchable. * database by a Php array, mapped by a jsonb into the database. This has one advantage: it is easily searchable.
* *
* As the list of type is hardcoded into database, it is more easily searchable. (for chill 2.0, the * As the list of type is hardcoded into database, it is more easily searchable. (for chill 2.0, the
* @link{Chill\ThirdPartyBundle\Form\Type\PickThirdPartyDynamicType} does not support it yet, but * @see{Chill\ThirdPartyBundle\Form\Type\PickThirdPartyDynamicType} does not support it yet, but
* the legacy @link{Chill\ThirdPartyBundle\Form\Type\PickThirdPartyType} does. * the legacy @see{Chill\ThirdPartyBundle\Form\Type\PickThirdPartyType} does.
* *
* The difference between categories and types is transparent for user: they choose the same fields into the UI, without * The difference between categories and types is transparent for user: they choose the same fields into the UI, without
* noticing a difference. * noticing a difference.