Search code examples
phpsymfonysonata-adminsymfony-sonatasymfony-cmf

valid_children setting for Symfony Sonata / CMF


Continuing on the journey to install the Symfony2 CMF, I am getting the error:

[InvalidArgumentException]                                                                                                                                           
The following document types provided in valid_children are invalid:
Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page 
The class names provided could not be loaded.  

The following lines causing this error are here in the config.yml file:

sonata_doctrine_phpcr_admin:
    document_tree:
        /...
        Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page:
            valid_children:
                - all
        /...

I am following the instructions from the docs here: http://symfony.com/doc/current/cmf/cookbook/creating_cms_using_cmf_and_sonata.html

below Configuration. Is this an error in the docs, or a setting that need to adjust? The docs do not explain what the valid_children parameter is controlling or the possible settings.

What are the possible options for this setting? Any further explanation of what this code is actually doing would be beneficial.


Solution

  • Thanks for trying the CMF tutorials! This documentation was not tested recently (as the warning at the head of the page says). Thanks for pointing out this issue. I updated the tutorial and added some explanation:

    The tree is used to know what is allowed in the left side of the admin dashboard, and also for sonata tree widgets. Classes in the tree where not validated at the time this tutorial was written, but are validated now to detect typos explicitly rather than having no clue why things do not show up in the tree. The simple cms is another bundle that can be used with the cmf, but which is not installed in the prerequisite tutorial...

    http://symfony.com/doc/current/cmf/cookbook/creating_cms_using_cmf_and_sonata.html will be updated in the next few minutes.

    Please open github issues on symfony-cmf-docs if you find further issues with this tutorial or elsehwere in the documentation.