Details
Description
When using class table inheritance, it is possible for a parent class proxy to get saved into the identifier map.
Classes:
/** * @Entity * @InheritanceType("JOINED") * @DiscriminatorColumn(name="discr", type="string") * @DiscriminatorMap({"employee" = "Employee", "customer" = "Customer"}) */ class Person { ... } /** @Entity */ class Employee extends Person { ... public function getEmployeeNumber() ... }
The following will fail:
$person = $entityManager->getReference('Person', 1); // the identity map contains a PersonProxy with id 1
...
$employee = $entityManger->getReference('Employee', 1); // $employee is set to the PersonProxy object in the identity map
...
$employee->getEmployeeNumber(); // error, PersonProxy object does not have a getEmployeeNumber method
Fixed this issue. Classes that have further entity subclasses CANNOT be loaded by reference. This is a technical requirement. Go live with it inheritance users
Also updated the docs: