0

我一直在尝试使用 Symfony-CMF 为我的项目设置 Sonata Admin,但在尝试添加菜单项时出现了一些错误。

如何解决这个问题?

错误:

在链配置的命名空间 Doctrine\ODM\PHPCR\Document 中找不到类“Symfony\Cmf\Bundle\MenuBundle\Document\MenuItem”

日志:

DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest". 
DEBUG - SET NAMES UTF8 
DEBUG - SELECT t0.id AS id1, t0.name AS name2, t0.billing_address AS billing_address3, t0.contact_name AS contact_name4, t0.contact_email_address AS contact_email_address5, t0.contact_phone_number AS contact_phone_number6 FROM client t0 
DEBUG - SELECT t0.id AS id1, t0.name AS name2, t0.billing_address AS billing_address3, t0.contact_name AS contact_name4, t0.contact_email_address AS contact_email_address5, t0.contact_phone_number AS contact_phone_number6 FROM client t0 
INFO - Matched route "admin_bundle_menu_menuitem_create" (parameters: "_controller": "Sonata\AdminBundle\Controller\CRUDController::createAction", "_sonata_admin": "symfony_cmf_menu.admin", "_sonata_name": "admin_bundle_menu_menuitem_create", "_route": "admin_bundle_menu_menuitem_create") 
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest". 
DEBUG - Read SecurityContext from the session 
DEBUG - Reloading user from user provider. 
DEBUG - SELECT t1.username AS username2, t1.username_canonical AS username_canonical3, t1.email AS email4, t1.email_canonical AS email_canonical5, t1.enabled AS enabled6, t1.salt AS salt7, t1.password AS password8, t1.last_login AS last_login9, t1.locked AS locked10, t1.expired AS expired11, t1.expires_at AS expires_at12, t1.confirmation_token AS confirmation_token13, t1.password_requested_at AS password_requested_at14, t1.roles AS roles15, t1.credentials_expired AS credentials_expired16, t1.credentials_expire_at AS credentials_expire_at17, t1.id AS id18, t1.fb_uid AS fb_uid19, t1.tw_uid AS tw_uid20, t0.categorySelectFlag AS categorySelectFlag21, t0.paypalName AS paypalName22, t1.type FROM seeder t0 INNER JOIN user t1 ON t0.id = t1.id WHERE t1.id = ? LIMIT 1 
DEBUG - SELECT t1.username AS username2, t1.username_canonical AS username_canonical3, t1.email AS email4, t1.email_canonical AS email_canonical5, t1.enabled AS enabled6, t1.salt AS salt7, t1.password AS password8, t1.last_login AS last_login9, t1.locked AS locked10, t1.expired AS expired11, t1.expires_at AS expires_at12, t1.confirmation_token AS confirmation_token13, t1.password_requested_at AS password_requested_at14, t1.roles AS roles15, t1.credentials_expired AS credentials_expired16, t1.credentials_expire_at AS credentials_expire_at17, t1.id AS id18, t1.fb_uid AS fb_uid19, t1.tw_uid AS tw_uid20, t0.client_id AS client_id21, t1.type FROM manager t0 INNER JOIN user t1 ON t0.id = t1.id WHERE t1.id = ? LIMIT 1 
DEBUG - Username "admin" was reloaded from user provider. 
DEBUG - Notified event "kernel.request" to listener "Doctrine\Bundle\PHPCRBundle\EventListener\LocaleListener::onKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "MyProject\MyBundle\Listener\Kernel::onKernelRequest". 
DEBUG - Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector::onKernelController". 
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController". 
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController". 
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController". 
DEBUG - Notified event "kernel.controller" to listener "Acme\DemoBundle\EventListener\ControllerListener::onKernelController". 
DEBUG - Notified event "kernel.controller" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelController". 
DEBUG - Notified event "kernel.exception" to listener "Symfony\Component\Security\Http\Firewall\ExceptionListener::onKernelException". 
DEBUG - Notified event "kernel.exception" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelException". 
DEBUG - Notified event "kernel.exception" to listener "Symfony\Component\HttpKernel\EventListener\ExceptionListener::onKernelException". 
CRITICAL - Doctrine\Common\Persistence\Mapping\MappingException: The class 'Symfony\Cmf\Bundle\MenuBundle\Document\MenuItem' was not found in the chain configured namespaces Doctrine\ODM\PHPCR\Document (uncaught exception) at /var/www/likeseed/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php line 38 
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "Doctrine\Bundle\PHPCRBundle\EventListener\LocaleListener::onKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest". 
DEBUG - Notified event "kernel.request" to listener "MyProject\MyBundle\Listener\Kernel::onKernelRequest". 
DEBUG - Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector::onKernelController". 
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController". 
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController". 
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController". 
DEBUG - Notified event "kernel.controller" to listener "Acme\DemoBundle\EventListener\ControllerListener::onKernelController". 
DEBUG - Notified event "kernel.controller" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelController". 
4

2 回答 2

2

我在 config.yml 的教义_phpcr 部分中添加了这个:

odm:
    auto_mapping: true

现在它可以工作了。

于 2012-08-21T09:59:39.053 回答
0

错误解释了自己。我想您应该寻找缺少的 MenuItem 类并将其放置在正确的命名空间中

于 2012-08-20T07:00:32.657 回答