0
我有一個表(ayrshireminis_car_category
),它是用分層結構構建的。使用Gedmo擴展獲得層次結構中的Symfony/Doctrine實體的級別
我正在嘗試使用Doctrine Gedmo extension來拉出我在其他地方使用的「level」成員變量,所以我期望父級的級別爲1,孩子的級別爲2級孫子有3個級別等等...
這是我的映射實體:
AyrshireMinis\CarBundle\Entity\Category:
type: entity
table: ayrshireminis_car_category
gedmo:
tree:
type: nested
id:
id:
type: integer
length: 11
generator: { strategy: AUTO }
fields:
name:
type: string
length: 150
active:
type: boolean
default: true
position:
type: integer
length: 11
level:
type: integer
gedmo:
- treeLevel
createdAt:
type: datetime
gedmo:
timestampable:
on: create
column: created_at
updatedAt:
type: datetime
gedmo:
timestampable:
on: update
column: updated_at
manyToOne:
parent:
targetEntity: AyrshireMinis\CarBundle\Entity\Category
inversedBy: children
gedmo:
- treeParent
createdBy:
targetEntity: \Sylius\Component\Core\Model\UserInterface
joinColumn:
nullable: false
name: created_by
gedmo:
blameable:
on: create
updatedBy:
targetEntity: \Sylius\Component\Core\Model\UserInterface
joinColumn:
nullable: false
name: updated_by
gedmo:
blameable:
on: update
oneToMany:
products:
targetEntity: AyrshireMinis\CarBundle\Entity\Product
mappedBy: category
有了這個映射,我得到了以下錯誤:
Missing properties: left, right in class - AyrshireMinis\CarBundle\Entity\Category 500 Internal Server Error - InvalidMappingException
^h不過,我不想在我的表格中留下「左」和「右」列。我怎樣才能解決這個問題?