sonata-project / SonataDoctrinePhpcrAdminBundle

[Abandoned] Symfony Sonata / Integrate Doctrine PHPCR into the SonataAdminBundle
https://sonata-project.org
MIT License
34 stars 92 forks source link

SimpleBlock not recognized in tree #193

Closed phiamo closed 11 years ago

phiamo commented 11 years ago

sonata_doctrine_phpcr_admin:
    document_tree:
        Doctrine\ODM\PHPCR\Document\Generic:
            valid_children:
                - all
        Symfony\Cmf\Bundle\ContentBundle\Doctrine\Phpcr\StaticContent:
            valid_children:
                - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\SimpleBlock
                - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\AbstractBlock
                - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ContainerBlock
                - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ReferenceBlock
                - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ActionBlock
        Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ReferenceBlock:
            valid_children: []
        Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page:
            valid_children:
                - all
        Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route:
            valid_children:
                - Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route
                - Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute
        Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute:
            valid_children: []
        Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr\MenuNode:
            valid_children:
                - Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr\MenuNode

using this config and creating a SimpleBlock does show it in the tree but get rel: undefined, and then has no actions ReferenceBlock works well ....

dbu commented 11 years ago

@phiamo did you check if it works if you add something like

 Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\SimpleBlock:
        valid_children: []

i think #180 should have made possible what you try to do, but maybe there is an issue. @benglass does this tell you anything?

phiamo commented 11 years ago

perfect, that did the trick

dbu commented 11 years ago

@benglass: then i think part of what you intended to do in #180 did not happen. can you make sure that everything that is found in a valid child list but has no own entry is treated as if it has its on entry with no valid children?

benglass commented 11 years ago

@dbu i think this is how its supposed to work. If you dont provide a mapping for the node it should not appear in the list. This makes it possible to have it as a top level node and not appear if you dont want it to appear but to be able to appear as a child node. It also makes it possible to have a child node appear without the ability to create/delete it but perhaps this is something that should be determined by sonata admin permissions and not this mapping. This is not an area of behavior that has a clear-cut right/wrong answer as to how it should behave (in my opinion) but requiring that you provide a mapping for a doc if you want it to have a context menu makes sense to me. Im open for disagreement.

This request potentially indicates a need to clarify the docs with regard to the purpose of the document_tree config?

dbu commented 11 years ago

+1 for not changing the existing behaviour at this point but improve the doc.

the sonata phpcr doc has kind of fallen between the tables: there is a bit in the cmf docs and a bit in the sonata repo. there is an issue in the doc issue tracker: https://github.com/symfony-cmf/symfony-cmf-docs/issues/285 . i will for now add a note there. if you would be interested to build that documentation, that would be a very welcome contribution indeed.