Closed
Description
Symfony version(s) affected: 4.1.x
Description
When I attach to an object of mine through Yaml or annotation one of the EqualsTo/NotEqualsTo/IdenticalTo/NotIdenticalTo
constraints then this line returns the object that the constraint is attached to.
App\Form\Transfer:
properties:
from:
- NotIdenticalTo:
propertyPath: 'to'
So the line above will return the object App\Form\Transfer
If I add the constraint on a form type like this:
$builder
->add('from', ChoiceType::class, [
'constraints' => [
new NotIdenticalTo(['propertyPath' => 'to']),
],
])
The line above will bring back a form object.
This causes the constraint to throw an exception because it reaches on this line and in the Form object the path of the property it does not exist.
How to reproduce
Build a form in the way described above and submit it.