I'm having issue with parent-child list view in symfony gedmo doctrine extensions.
My list is showing everything in the same level and I don't know how to fix it.
I've tried to use datagridvalues
to sort by lft
field but it is not working.
My category.orm.yml
file
Application\AdminBundle\Entity\Category:
type: entity
table: Category
gedmo:
tree:
type: nested
id:
id:
type: integer
generator:
strategy: AUTO
fields:
name:
type: string
length: 255
image_url:
type: string
length: 255
slug:
type: string
nullable: false
unique: true
lft:
type: integer
gedmo:
- treeLeft
rgt:
type: integer
gedmo:
- treeRight
root:
type: integer
gedmo:
- treeRoot
lvl:
type: integer
gedmo:
- treeLevel
oneToMany:
children:
targetEntity: Category
mappedBy: parent
manyToOne:
parent:
targetEntity: Category
inversedBy: children
gedmo:
- treeParent
joinColumns:
Category_id:
referencedColumnName: id
lifecycleCallbacks: { }
And My configureListFields method:
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->add('id')
->add('name')
->add('slug')
;
}