views:

111

answers:

1

I think the answer to this question should be: No. However I hope to be corrected.

I'd like to edit our database using a mixture of YAML markup + Doctrine createTables() and Navicat editing. Can I maintain the inheritance which is marked up?

Example (4 steps, at step 4, Doctrine is in no way able to re-create the inheritance schema... or is it?):

Step 1: Create YAML with inheritance

---
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

Step 2: Create tables using Doctrine (and drop/create db if nessecary)

Created sql:

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

Step 3: Edit table using Navicat Step 4: Refresh YAML file because of 'external' edits...

+1  A: 

Unfortunately, you are right.

Doctrine inheritance has no impact on the database schema so you won't be able to re-create the inheritance yaml from a sql dump. It only change the Doctrine model files, which in your case basically means that User and Group classes inherits from Entity class. (In the case of column aggregation inheritance, it also adds a "type" columns with the class name inside).

Sorry if my answer isn't perfectly clear ... :)

More infos here.

DuoSRX
Thanks for acknowledging. I have a solution though, i should look better at advertisements: http://www.orm-designer.com/doctrine
Ropstah