I'm using Doctrine 1.2 on a symfony project, and I'm considering mixing concrete and column aggregation inheritance types in my schema: column aggregation lets me query in a parent table and get both parent and child records, while concrete inheritance lets me get a cleaner schema. Plus, the mix will be in the same inheritance chain. How would I write the schema file? Like the following?
A:
B:
inheritance:
extends: A
type: concrete
C:
inheritance:
extends: B
type: column_aggregation
keyField: type
keyValue: 1
开发者_如何学C
Or like this perhaps:
A:
B:
inheritance:
extends: A
type: concrete
C:
inheritance:
extends: B
type: concrete
D:
inheritance:
extends: C
type: column_aggregation
keyField: type
keyValue: 1
E:
inheritance:
extends: C
type: column_aggregation
keyField: type
keyValue: 2
Are there any dangers/caveats ?
As long as you avoid circular inheritance or diamond shaped inheritance you would be fine and can use this
A circular inheritance (obviously looks as follows
Class A Extends B Class B Extends A
OR
CLASS A EXTENDS C
CLASS B EXTENDS A
CLASS C EXTENDS A
A Diamond Shaped inheritance is a bit more round about. It happens when the following type of condition happens
CLASS A
CLASS B EXTENDS A
CLASS C EXTENDS A
CLASS D EXTENDS B,C
精彩评论