Closed lowki closed 10 years ago
templates_by_class
it works just the same as with documents that do not extend each other. just keep in mind that the matching is instanceof
so you need to put the child classes first and the parent after.ideally, you never use Page directly but only your custom extended page or the product. then you define one admin per class. if you keep the SimpleCms Page admin in the system, its list will list you all extending documents mixed together and try to edit those, which is not helpful. (a shortcoming of sonata admin, see https://github.com/sonata-project/SonataDoctrinePhpcrAdminBundle/issues/80 for further reference)
btw, you can also have your Admin extend the simplecms admin and just add the missing fields. sonata admin even has a method to reorder those fields, should you need that.
Ok, the doc says this about extending
cmf_simple_cms:
persistence:
phpcr:
document_class: Acme\DemoBundle\Document\MySuperPage
So, could I use many of them?
this is only if you want to use the default setup with a custom class. if your MySuperPage has additional fields, you would also need a custom admin and set that with the admin_class.
what you need to do is define a second admin for your other document. you can look at the service definitions of SimpleCmsBundle to get inspiration, or read up in the sonata documentation how you do your own admins.
I think I've made it through. As soon as my knowledge permit it, I enhance the doc about this. Thank you one more time David.
you are welcome! looking forward to doc updates.
Hi, I have two different documents to manage, pages and products. And I would like to have a tree like this.
So I have a few questions :