You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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;
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.
The text was updated successfully, but these errors were encountered:
Comparing by identity is intended. Comparing objects by value can create very weird results, as it compares all properties in the object graph (this can even create an infinite loop if you object graph is cyclic).
Note that in the case of Doctrine, you always get a single instance for a given entity, so the comparison works well.
If Propel gives several instances for the same row, it would indeed be tricky (Propel gives you a equals method to do the comparison, but this works only for code aware of Propel to use it)
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;
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 thegetValuesForChoices
function. In this functionif ($choice === $givenChoice) {
will not work for classes. You must change this toif ($choice == $givenChoice) {
. I tested and now it can tick the choices which are on the follow table.The text was updated successfully, but these errors were encountered: