Generate entities does not extends from base class #5601

Closed
opened 2026-01-22 15:12:28 +01:00 by admin · 1 comment
Owner

Originally created by @smartwaresolutions on GitHub (Jul 7, 2017).

Originally assigned to: @Ocramius on GitHub.

I have 2 xml files with entity definitions: one (base) is a mapped-superclass and the other (User) extends from this class. After Generate-entities the User class does not extends the base class. Both PHP files are created.

XML files:


<?xml version="1.0"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
  <mapped-superclass name="base">
    <field name="version" type="integer" nullable="false"/>
  </mapped-superclass>
</doctrine-mapping>

<?xml version="1.0"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
  <entity name="User" extends="base" table="Users">
    <id name="id" type="integer">
      <generator strategy="AUTO"/>
    </id>
    <field name="name" type="string" nullable="true"/>
    <field name="email" type="string" unique="true" nullable="true"/>
    <field name="password" type="string" nullable="true"/>
  </entity>
</doctrine-mapping>

Originally created by @smartwaresolutions on GitHub (Jul 7, 2017). Originally assigned to: @Ocramius on GitHub. I have 2 xml files with entity definitions: one (base) is a mapped-superclass and the other (User) extends from this class. After Generate-entities the User class does not extends the base class. Both PHP files are created. XML files: ``` <?xml version="1.0"?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <mapped-superclass name="base"> <field name="version" type="integer" nullable="false"/> </mapped-superclass> </doctrine-mapping> <?xml version="1.0"?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <entity name="User" extends="base" table="Users"> <id name="id" type="integer"> <generator strategy="AUTO"/> </id> <field name="name" type="string" nullable="true"/> <field name="email" type="string" unique="true" nullable="true"/> <field name="password" type="string" nullable="true"/> </entity> </doctrine-mapping> ```
admin added the ImprovementWon't FixQuestion labels 2026-01-22 15:12:28 +01:00
admin closed this issue 2026-01-22 15:12:28 +01:00
Author
Owner

@Ocramius commented on GitHub (Jul 7, 2017):

Inheritance is generally not supported by the entity generator.

Closing as won't fix

@Ocramius commented on GitHub (Jul 7, 2017): Inheritance is generally not supported by the entity generator. Closing as `won't fix`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5601