I have a Doctrine 1.2 project that I'm refactoring in order to have a tree structure for a table using doctrine beahaviour NestedSet with multiple roots.
What I need is an inheritance (Not in the OO common sense) from ancestors to descendants in which the descendants inherits properties from the closest ancestor where their own properties are missing. Same thing would happen with relations.
Let me explain with an example:
Category:
actAs:
NestedSet:
hasManyRoots: true
rootColumnName: root_id
columns:
name: string(50)
another_property: string(50)
active: boolean
Tag:
columns:
value: string(50)
CategoryTag:
columns:
category_id: integer
tag_id: integer
What I want to perform is:
- retrieve if a category is active, that means verifying if all the ancestors are active
- if another_property is missing for a given category, inherit it from closest ancestor in which is present
- retrieve tags for a given category; if tags are missing, retrieve them from the closest ancestor
What would you suggest as best approach in order to maximize speed and flexibility?