Doctrine Column-Aggregation Inheritance

491 views Asked by At

I'm trying to implement Doctrine column-aggregation inheritance

I copied the Yaml structure from the Doctrine guide and paste it in my schema.yml file:

Entity:
  columns:
    username: string(20)
    password: string(16)
    created_at: timestamp
    updated_at: timestamp

User:
  inheritance:
    extends: Entity
    type: column_aggregation
    keyField: type
    keyValue: 1

Group:
  inheritance:
    extends: Entity
    type: column_aggregation
    keyField: type
    keyValue: 2

But when I use the doctrine:build-model and doctrine:build-sql commands from symfony's command line, the sql file I get contains two similar lines for creating the Entity table:

CREATE TABLE entity (id BIGINT AUTO_INCREMENT, username VARCHAR(20), password VARCHAR(16), created_at DATETIME, updated_at DATETIME, type VARCHAR(255), INDEX entity_type_idx (type), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE entity (id BIGINT AUTO_INCREMENT, username VARCHAR(20), password VARCHAR(16), created_at DATETIME, updated_at DATETIME, type VARCHAR(255), PRIMARY KEY(id)) ENGINE = INNODB;

Which ofcourse causes an error when I try to import it to my database..

Is it a build-in bug in Symfony's command-line?

1

There are 1 answers

0
tamir On BEST ANSWER

Well, it looks like it is a reported bug and it will only work in Doctrine 2