-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Labels
Description
I debug myself a bug which you can reproduce by using propel1's model form field type in a form. I used the field type for many to many relation to render a multi selectable checkgroup;
$builder->add('products', 'model', array(
'class' => 'Acme\XXBundle\Model\Product',
'property' => 'name',
'label' => ' ',
'expanded' => true,
'multiple' => true,
'attr' => ['class'=>'css-checkbox'],
));
this is for Company->Follows<-Products (Many company can follow many product)
but when rendered the form followed products didn't come ticked for the company. I debug and the problem is on vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.php
in the getValuesForChoices
function. In this function
if ($choice === $givenChoice) {
will not work for classes. You must change this to if ($choice == $givenChoice) {
. I tested and now it can tick the choices which are on the follow table.