crudification for thirdparty

This commit is contained in:
2021-10-06 12:30:18 +02:00
parent a8edef13a3
commit 7ea2c36c5e
16 changed files with 275 additions and 242 deletions

View File

@@ -3,8 +3,10 @@
namespace Chill\ThirdPartyBundle\Form;
use Chill\MainBundle\Entity\Address;
use Chill\MainBundle\Form\Type\PickCenterType;
use Chill\MainBundle\Form\Type\ChillTextareaType;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Chill\ThirdPartyBundle\Entity\ThirdPartyCategory;
use Chill\ThirdPartyBundle\Entity\ThirdPartyCivility;
use Chill\ThirdPartyBundle\Entity\ThirdPartyProfession;
@@ -129,12 +131,22 @@ class ThirdPartyType extends AbstractType
->add('comment', ChillTextareaType::class, [
'required' => false
])
->add('centers', PickCenterType::class, [
'role' => $this->om->contains($options['data']) ?
ThirdPartyVoter::UPDATE : ThirdPartyVoter::CREATE,
'choice_options' => [
'multiple' => true,
'attr' => ['class' => 'select2']
]
])
/*
->add('centers', EntityType::class, [
'choices' => $this->getReachableCenters($options),
'class' => \Chill\MainBundle\Entity\Center::class,
'multiple' => true,
'attr' => ['class' => 'select2']
])
*/
;
$builder
@@ -228,12 +240,14 @@ class ThirdPartyType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Chill\ThirdPartyBundle\Entity\ThirdParty'
'data_class' => ThirdParty::class
));
/*
$resolver->setRequired('usage')
->setAllowedValues('usage', ['create', 'update'])
;
*/
}
/**