Details
Description
When using inheritance with identifier in the superclass, results in an error trying to generate code.
Example:
/**
* Demo\TestInheritanceBundle\Entity\TestBase
*
* @ORM\Table()
* @ORM\Entity
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="discr", type="string")
* @ORM\DiscriminatorMap({"test" = "Test"})
*/
class TestBase
{
/**
* @var integer $id
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
}
class Test
{
}
will throw an exception because the DisconnectedClassMetadataFactory disables the code that examines the parent classes.
I've created a simple function that can be used to figure out if a parent has defined an identifier that can be used by the subclass.
Patch attached.
Issue Links
- depends on
-
DDC-1254
EntityGenerator does not respect Class Inheritance properly
-
you should also check if there is a parentclass registered
19: if ( ! $this->driver->isTransient($parentClass) && !empty($this->loadedMetadata[$parentClass])) {