Próbuję dzisiaj zmusić do działania rozrszerzenie Tree z DoctrineExtension z MongoDB.
Zainstalowałem też StofDoctrineExtensionsBundle.
Przy próbie zapisu dokumentu do bazy dostaję taki komunikat:
Cytat
Cannot persist an embedded document or mapped superclass My\FrontendBundle\Document\Category
Moja konfiguracja wygląda następująco:
doctrine_mongodb:
connections:
default:
server: mongodb://localhost:27017
options: {}
default_database: plik
document_managers:
default:
auto_mapping: true
mappings:
gedmo_tree:
type: yml
prefix: Gedmo\Tree\Document
dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/Document"
alias: GedmoTree # this one is optional and will default to the name set for the mapping
is_bundle: false
stof_doctrine_extensions:
default_locale: en_US
mongodb:
default:
tree: true
Plik mapowania:
My\FrontendBundle\Document\Category:
type: mappedSuperclass
repositoryClass: Gedmo\Tree\Document\MongoDB\Repository\MaterializedPathRepository
collection: categories
gedmo:
tree:
type: materializedPath
activateLocking: true
fields:
id:
id: true
title:
type: string
gedmo:
- sluggable
slug:
type: string
gedmo:
0: treePathSource
slug:
unique: false
fields:
- title
path:
type: string
gedmo:
treePath:
separator: '/'
appendId: false
startsWithSeparator: false # default
endsWithSeparator: true # default
level:
type: int
name: lvl
nullable: true
gedmo:
- treeLevel
lockTime:
type: date
gedmo:
- treeLockTime
hash:
type: string
gedmo:
- treePathHash
parent:
reference: true
type: one
inversedBy: children
targetDocument: My\FrontendBundle\Document\Category
simple: true
gedmo:
- treeParent
Wszystko wygląda dobrze, nie wiem co może być nie tak, proszę o pomoc.