symfony-cmf / tree-browser-bundle

Integrates javascript tree browser with PHPCR and PHPCR-ODM.
https://cmf.symfony.com
Other
22 stars 17 forks source link

Handle root node not found #25

Open dantleech opened 11 years ago

dantleech commented 11 years ago

It seems currently that if I specify a non-existant node as the root_node in doctrine_phpcr_type_tree_model the backend throws an Exception. I guess it would be good to catch this error and tell the user that the specified root node does not exist.

[exception] 500 | Internal Server Error | Doctrine\Common\Persistence\Mapping\MappingException
[message] The class 'Doctrine\Common\Util\ClassUtils' was not found in the chain configured namespaces Doctrine\ODM\PHPCR\Document, Symfony\Cmf\Bundle\MenuBundle\Document, Symfony\Cmf\Bundle\ContentBundle\Document, Symfony\Cmf\Bundle\BlockBundle\Document, Symfony\Cmf\Bundle\SimpleCmsBundle\Document, Symfony\Cmf\Bundle\BlogBundle\Document, Symfony\Cmf\Bundle\CreateBundle\Document, Sandbox\MainBundle\Document, Symfony\Cmf\Bundle\RoutingExtraBundle\Document, Symfony\Component\Routing
[1] Doctrine\Common\Persistence\Mapping\MappingException: The class 'Doctrine\Common\Util\ClassUtils' was not found in the chain configured namespaces Doctrine\ODM\PHPCR\Document, Symfony\Cmf\Bundle\MenuBundle\Document, Symfony\Cmf\Bundle\ContentBundle\Document, Symfony\Cmf\Bundle\BlockBundle\Document, Symfony\Cmf\Bundle\SimpleCmsBundle\Document, Symfony\Cmf\Bundle\BlogBundle\Document, Symfony\Cmf\Bundle\CreateBundle\Document, Sandbox\MainBundle\Document, Symfony\Cmf\Bundle\RoutingExtraBundle\Document, Symfony\Component\Routing
                at n/a
                    in /home/daniel/www/cmf-sandbox/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php line 38

                at Doctrine\Common\Persistence\Mapping\MappingException::classNotFoundInNamespaces('Doctrine\Common\Util\ClassUtils', array('Doctrine\ODM\PHPCR\Document', 'Symfony\Cmf\Bundle\MenuBundle\Document', 'Symfony\Cmf\Bundle\ContentBundle\Document', 'Symfony\Cmf\Bundle\BlockBundle\Document', 'Symfony\Cmf\Bundle\SimpleCmsBundle\Document', 'Symfony\Cmf\Bundle\BlogBundle\Document', 'Symfony\Cmf\Bundle\CreateBundle\Document', 'Sandbox\MainBundle\Document', 'Symfony\Cmf\Bundle\RoutingExtraBundle\Document', 'Symfony\Component\Routing'))
                    in /home/daniel/www/cmf-sandbox/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php line 114

                at Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain->loadMetadataForClass('Doctrine\Common\Util\ClassUtils', object(ClassMetadata))
                    in /home/daniel/www/cmf-sandbox/vendor/doctrine/phpcr-odm/lib/Doctrine/ODM/PHPCR/Mapping/ClassMetadataFactory.php line 128

                at Doctrine\ODM\PHPCR\Mapping\ClassMetadataFactory->doLoadMetadata(object(ClassMetadata), null, false, array())
                    in /home/daniel/www/cmf-sandbox/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php line 302

                at Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata('Doctrine\Common\Util\ClassUtils')
                    in /home/daniel/www/cmf-sandbox/vendor/doctrine/phpcr-odm/lib/Doctrine/ODM/PHPCR/Mapping/ClassMetadataFactory.php line 96

                at Doctrine\ODM\PHPCR\Mapping\ClassMetadataFactory->loadMetadata('Doctrine\Common\Util\ClassUtils')
                    in /home/daniel/www/cmf-sandbox/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php line 205

                at Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor('Doctrine\Common\Util\ClassUtils')
                    in /home/daniel/www/cmf-sandbox/vendor/doctrine/phpcr-odm/lib/Doctrine/ODM/PHPCR/Mapping/ClassMetadataFactory.php line 81

                at Doctrine\ODM\PHPCR\Mapping\ClassMetadataFactory->getMetadataFor('Doctrine\Common\Util\ClassUtils')
                    in /home/daniel/www/cmf-sandbox/vendor/sonata-project/doctrine-phpcr-admin-bundle/Sonata/DoctrinePHPCRAdminBundle/Model/ModelManager.php line 50

                at Sonata\DoctrinePHPCRAdminBundle\Model\ModelManager->getMetadata('Doctrine\Common\Util\ClassUtils')
                    in /home/daniel/www/cmf-sandbox/vendor/sonata-project/doctrine-phpcr-admin-bundle/Sonata/DoctrinePHPCRAdminBundle/Tree/PhpcrOdmTree.php line 213

                at Sonata\DoctrinePHPCRAdminBundle\Tree\PhpcrOdmTree->getDocumentChildren(null)
                    in /home/daniel/www/cmf-sandbox/vendor/sonata-project/doctrine-phpcr-admin-bundle/Sonata/DoctrinePHPCRAdminBundle/Tree/PhpcrOdmTree.php line 97

                at Sonata\DoctrinePHPCRAdminBundle\Tree\PhpcrOdmTree->getChildren('/cms/blog')
                    in /home/daniel/www/cmf-sandbox/vendor/symfony-cmf/tree-browser-bundle/Symfony/Cmf/Bundle/TreeBrowserBundle/Controller/TreeBrowserController.php line 49

                at Symfony\Cmf\Bundle\TreeBrowserBundle\Controller\TreeBrowserController->processNode('/cms/blog', 'getChildren')
                    in /home/daniel/www/cmf-sandbox/vendor/symfony-cmf/tree-browser-bundle/Symfony/Cmf/Bundle/TreeBrowserBundle/Controller/TreeBrowserController.php line 64

                at Symfony\Cmf\Bundle\TreeBrowserBundle\Controller\TreeBrowserController->childrenAction(object(Request))
                    in  line 

                at call_user_func_array(array(object(TreeBrowserController), 'childrenAction'), array(object(Request)))
                    in /home/daniel/www/cmf-sandbox/app/bootstrap.php.cache line 1426

                at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
                    in /home/daniel/www/cmf-sandbox/app/bootstrap.php.cache line 1390

                at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
                    in /home/daniel/www/cmf-sandbox/app/bootstrap.php.cache line 1566

                at Symfony\Bundle\FrameworkBundle\HttpKernel->handle(object(Request), '1', true)
                    in /home/daniel/www/cmf-sandbox/app/bootstrap.php.cache line 617

                at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
                    in /home/daniel/www/cmf-sandbox/web/app_dev.php line 29
dbu commented 11 years ago

that is a weird exception to get for a document not found problem. we might also want to check what is triggering this situation. but either way i agree we should find a way to alert the user what is going wrong. if it includes overhead for sanity checks, we could do those in dev environment only maybe.

lsmith77 commented 11 years ago

ping

dbu commented 11 years ago

@dantleech you where talking about a completely replaced tree bundle for after 1.0 that would be more sane. if we plan that for 1.1, we might just ignore this issue.

lsmith77 commented 11 years ago

ok .. dropping the milestone ..

wouterj commented 9 years ago

https://github.com/symfony-cmf/ResourceRestBundle/pull/17 will solve this question for 2.0. After that PR is merged, the result (in case of an undefined root node) will be:

cmf-tree-not-found

dbu commented 9 years ago

a missing root path will still be a unresolvable situation for the user if the item in that field is required. but at least the DX will be better. would /foo be the root path? that would mean that i can edit the root path which would be against the idea of limiting what range the user can select from... if the root path is not shown, maybe it should be visible in the error message.