Skip to content

Instantly share code, notes, and snippets.

@ludofleury
Created December 21, 2010 01:09
Show Gist options
  • Save ludofleury/749322 to your computer and use it in GitHub Desktop.
Save ludofleury/749322 to your computer and use it in GitHub Desktop.
Symfony Doctrine : How to have multiple hierarchical data in 1 table but with the logic splitted into X models.
Category:
collection_0:
name: Collection
root_id: 1
children:
collection_1:
name: Spring 2010
summary:
collection_2:
name: Summer 2010
summary:
collection_3:
name: Fall 2010
summary:
collection_4:
name: Winter 2010
summary:
type_0:
name: Type
root_id: 2 # type
children:
type_1:
name: Boucles d'oreille
summary:
type_2:
name: Bagues
summary:
type_3:
name: Broches
summary:
type_4:
name: Colliers
summary:
Category:
tableName: category
actAs:
NestedSet:
hasManyRoots: true
rootColumnName: root_id
Sluggable:
unique: true
fields: [name]
canUpdate: true
name: slug
type: string
length: 255
columns:
id:
type: integer
primary: true
autoincrement: true
name:
type: string(100)
notnull: true
summary:
type: string(140)
notnull: false
Collection:
inheritance:
type: column_aggregation
extends: Category
keyField: root_id
keyValue: 1
Type:
inheritance:
type: column_aggregation
extends: Category
keyField: root_id
keyValue: 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment