mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
FIX [review] implement changes based on review
This commit is contained in:
@@ -18,21 +18,25 @@ use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
/**
|
||||
* Pick user dymically, using vuejs module "AddPerson".
|
||||
* m* Pick user dymically, using vuejs module "AddPerson".
|
||||
*/
|
||||
class PickPersonDynamicType extends AbstractType
|
||||
{
|
||||
private DenormalizerInterface $denormalizer;
|
||||
|
||||
private DenormalizerInterface $normalizer;
|
||||
|
||||
private SerializerInterface $serializer;
|
||||
|
||||
public function __construct(DenormalizerInterface $denormalizer, SerializerInterface $serializer)
|
||||
public function __construct(DenormalizerInterface $denormalizer, SerializerInterface $serializer, NormalizerInterface $normalizer)
|
||||
{
|
||||
$this->denormalizer = $denormalizer;
|
||||
$this->serializer = $serializer;
|
||||
$this->normalizer = $normalizer;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
@@ -45,7 +49,10 @@ class PickPersonDynamicType extends AbstractType
|
||||
$view->vars['multiple'] = $options['multiple'];
|
||||
$view->vars['types'] = ['person'];
|
||||
$view->vars['uniqid'] = uniqid('pick_user_dyn');
|
||||
$view->vars['suggested'] = $this->serializer->serialize($options['suggested'], 'json', ['groups' => 'read']);
|
||||
|
||||
foreach ($options['suggested'] as $person) {
|
||||
$view->vars['suggested'][spl_object_hash($person)] = $this->normalizer->normalize($person, 'json', ['groups' => 'read']);
|
||||
}
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
|
Reference in New Issue
Block a user