DDC-3577: Inherited associations are ignored #4398

Open
opened 2026-01-22 14:40:57 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Feb 20, 2015).

Originally assigned to: @deeky666 on GitHub.

Jira issue originally created by user yethee:

Could not create schema via SchemaTool for entity, which has inherited accosiation mapping (this mapping is ignored).

private function gatherRelationsSql($class, $table, $schema, &$addedFks, &$blacklistedFks)
{
    foreach ($class->associationMappings as $mapping) {
        if (isset($mapping['inherited'])) {
            continue;
        }
...

I have three entity types:

  • BaseType — mapping mapped-superclass, has association many-to-one, join-column pid
  • SecondType extends BaseType — mapping entity
  • ThirdType extends SecondType — mapping entity

Table for ThirdType not has pid column after created scheme via SchemeTool. Inheritance mapping not using.

Originally created by @doctrinebot on GitHub (Feb 20, 2015). Originally assigned to: @deeky666 on GitHub. Jira issue originally created by user yethee: Could not create schema via SchemaTool for entity, which has inherited accosiation mapping (this mapping is ignored). ``` private function gatherRelationsSql($class, $table, $schema, &$addedFks, &$blacklistedFks) { foreach ($class->associationMappings as $mapping) { if (isset($mapping['inherited'])) { continue; } ... ``` I have three entity types: - BaseType — mapping `mapped-superclass`, has association `many-to-one`, join-column `pid` - SecondType _extends BaseType_ — mapping `entity` - ThirdType _extends SecondType_ — mapping `entity` Table for ThirdType not has `pid` column after created scheme via SchemeTool. Inheritance mapping not using.
admin added the Bug label 2026-01-22 14:40:57 +01:00
Author
Owner

@doctrinebot commented on GitHub (Feb 20, 2015):

Comment created by @ocramius:

This should actually be working: you probably need to provide a test case otherwise

@doctrinebot commented on GitHub (Feb 20, 2015): Comment created by @ocramius: This should actually be working: you probably need to provide a test case otherwise
Author
Owner

@doctrinebot commented on GitHub (Feb 20, 2015):

Comment created by yethee:

d55a8bc713
Test case for this issue.

$ phpunit --group=[DDC-3577](http://www.doctrine-project.org/jira/browse/DDC-3577)
PHPUnit 4.7-g7c1de6a by Sebastian Bergmann and contributors.

Configuration read from D:\Projects\doctrine2\phpunit.xml.dist

F

Time: 1.97 seconds, Memory: 81.75Mb

There was 1 failure:

1) Doctrine\Tests\ORM\Tools\SchemaToolTest::testInheritedAssociationShouldBeSupported
Table "ddc3577*interviews" should has column "user*id".
Failed asserting that false is true.
@doctrinebot commented on GitHub (Feb 20, 2015): Comment created by yethee: https://github.com/yethee/doctrine2/commit/d55a8bc71381db1c599da682c4baca0ce39d0d62 Test case for this issue. ``` $ phpunit --group=[DDC-3577](http://www.doctrine-project.org/jira/browse/DDC-3577) PHPUnit 4.7-g7c1de6a by Sebastian Bergmann and contributors. Configuration read from D:\Projects\doctrine2\phpunit.xml.dist F Time: 1.97 seconds, Memory: 81.75Mb There was 1 failure: 1) Doctrine\Tests\ORM\Tools\SchemaToolTest::testInheritedAssociationShouldBeSupported Table "ddc3577*interviews" should has column "user*id". Failed asserting that false is true. ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#4398