Closed
Description
Symfony version(s) affected: 4.4.11
Description
Form validation throws an exception on relation field which contains indexBy definition:
No mapping found for field 'foo_id' on class 'App\Entity\Foo'.
How to reproduce
/**
* @var Collection|Foo[]
* @ORM\OneToMany(targetEntity="App\Entity\Foo", mappedBy="bar", indexBy="foo_id", cascade={"persist", "remove"}, orphanRemoval=true)
* @Assert\Valid()
*/
private $foos;
Possible Solution
When I change indexBy from "foo_id" to "foo" no exception is thrown. However indexBy will stop working as it suppose to.
Additional context
I have updated project from Symfony v.4.3.4 where it was working.