Answer the question
In order to leave comments, you need to log in
symfony. How to set the current value in a form?
The client entity has a managerId property. Because the Customer entity is serializable, it is not possible to use a relationship with a Manager object that has image and file properties.
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $managerId;
->add('managerId', EntityType::class, [
'class' => Manager::class,
'mapped' => false,
'label' => 'Личный менеджер',
'choice_label' => 'name',
'choice_value' => function (Manager $entity = null) {
return $entity ? $entity->getId() : '';
},
'required' => false,
'multiple' => false,
'expanded' => false,
'query_builder' => function (EntityRepository $repo) {
return $repo->createQueryBuilder('s')
->andWhere('s.status = :val')
->setParameter(':val', Manager::STATUS_VISIBLE)
->orderBy('s.name', 'ASC');
},
])
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question