-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Description
BC Break Report
| Q | A |
|---|---|
| BC Break | yes |
| Version | 3.1.1 |
Summary
If a class has InheritanceType attribute and it extend another class that has at least a property, it generate an error duplicate definication of column the properties in the extended class for orm v3.1.1 and v3.1.0, but worked for v2.7.5.
In MappingException.php line 420:
Duplicate definition of column 'id' on entity 'Entity\CategoryLink' in a field or discriminator column mapping.
How to reproduce
The MappedSuperclass
namespace MappedSuperClass;
use \Doctrine\ORM\Mapping as ORM;
#[ORM\MappedSuperclass]
abstract class AbstractEntity {
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue]
protected ?int $id = null;
}
The class with InheritanceType attribute
namespace Entity;
use \Doctrine\ORM\Mapping as ORM;
use \MappedSuperClass\AbstractEntity;
/**
* @property mixed $Linked
*/
#[ORM\Entity]
#[ORM\Table(name: 'stock_tree')]
#[ORM\InheritanceType('JOINED')]
#[ORM\DiscriminatorColumn(name: 'discriminator', type: 'string')]
#[ORM\DiscriminatorMap([
'Category' => \Entity\CategoryLink::class
])]
class StockTreeEntity extends AbstractEntity {
}
An inheritor class
namespace Entity;
use \Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
#[ORM\Table(name: 'categories_link')]
class CategoryLink extends StockTreeEntity {
}
Run doctrine orm:schema-tool:update --dump-sql, generate the error
In MappingException.php line 420:
Duplicate definition of column 'id' on entity 'Entity\CategoryLink' in a field or discriminator column mapping.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels