我打算制作调度程序日历。所以我选择了calendR。
在page的说明指导下,我安装了frequence-web/calendr-bundle
然后我想使用带有Doctrine的CalendR。我补充说:
services:
booking_repository:
class: Your\Bundle\Entity\EventRepository
factory_service: doctrine.orm.default_entity_manager
factory_method: getRepository
arguments: ['YourEntity:ShortName']
tags:
- { name: calendr.event_provider }
我无法弄清楚应该替换'YourEntity:ShortName'
的内容。我通常在实体目录下创建一些类来连接到mysql数据库。
所以,我创建了名为Lesson
的类文件,然后将其替换为["Lesson:ShortName']
,但它说:
ORMException:未知实体名称空间别名'Lesson'
我的堆栈跟踪在下面。
in /Users/whitebear/httproot/musics/vendor/doctrine/orm/lib/Doctrine/ORM/ORMException.php line 236
at ORMException::unknownEntityNamespace('Lesson') in /Users/whitebear/httproot/musics/vendor/doctrine/orm/lib/Doctrine/ORM/Configuration.php line 192
at Configuration->getEntityNamespace('Lesson') in /Users/whitebear/httproot/musics/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php line 554
at ClassMetadataFactory->getFqcnFromAlias('Lesson', 'ShortName') in /Users/whitebear/httproot/musics/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php line 188
at AbstractClassMetadataFactory->getMetadataFor('Lesson:ShortName') in /Users/whitebear/httproot/musics/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php line 301
at EntityManager->getClassMetadata('Lesson:ShortName') in /Users/whitebear/httproot/musics/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php line 771
at EntityManager->getRepository('Lesson:ShortName') in /Users/whitebear/httproot/musics/app/cache/dev/jms_diextra/doctrine/EntityManager_51b213c320981.php line 207
at EntityManager->getRepository('Lesson:ShortName') in /Users/whitebear/httproot/musics/app/cache/dev/appDevDebugProjectContainer.php line 170
at appDevDebugProjectContainer->getBookingRepositoryService() in /Users/whitebear/httproot/musics/app/bootstrap.php.cache line 129
at Container->get('booking_repository') in /Users/whitebear/httproot/musics/app/cache/dev/appDevDebugProjectContainer.php line 1440
at appDevDebugProjectContainer->getFrequenceWebCalendr_Event_ManagerService() in /Users/whitebear/httproot/musics/app/bootstrap.php.cache line 129
at Container->get('frequence_web_calendr.event.manager') in /Users/whitebear/httproot/musics/app/cache/dev/appDevDebugProjectContainer.php line 1457
at appDevDebugProjectContainer->getFrequenceWebCalendr_FactoryService() in /Users/whitebear/httproot/musics/app/bootstrap.php.cache line 129
at Container->get('frequence_web_calendr.factory') in /Users/whitebear/httproot/musics/app/cache/dev/appDevDebugProjectContainer.php line 1473
at appDevDebugProjectContainer->getFrequenceWebCalendr_TwigExtensionService() in /Users/whitebear/httproot/musics/app/bootstrap.php.cache line 129
at Container->get('frequence_web_calendr.twig_extension') in /Users/whitebear/httproot/musics/app/cache/dev/appDevDebugProjectContainer.php line 4607
at appDevDebugProjectContainer->getTwigService() in /Users/whitebear/httproot/musics/app/bootstrap.php.cache line 129
at Container->get('twig') in /Users/whitebear/httproot/musics/app/cache/dev/appDevDebugProjectContainer.php line 100
at appDevDebugProjectContainer->getAssetic_AssetManagerService() in /Users/whitebear/httproot/musics/app/bootstrap.php.cache line 129
at Container->get('assetic.asset_manager') in /Users/whitebear/httproot/musics/app/cache/dev/appDevDebugProjectContainer.php line 2032
at appDevDebugProjectContainer->getRouting_LoaderService() in /Users/whitebear/httproot/musics/app/bootstrap.php.cache line 129
at Container->get('routing.loader') in /Users/whitebear/httproot/musics/app/cache/dev/classes.php line 1426
at Router->getRouteCollection() in /Users/whitebear/httproot/musics/app/cache/dev/classes.php line 1218
at Router->getMatcher() in /Users/whitebear/httproot/musics/app/cache/dev/classes.php line 1205
at Router->match('/') in /Users/whitebear/httproot/musics/app/cache/dev/classes.php line 3611
at RouterListener->onKernelRequest(object(GetResponseEvent))
at call_user_func(array(object(RouterListener), 'onKernelRequest'), object(GetResponseEvent)) in /Users/whitebear/httproot/musics/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php line 451
at Symfony\Component\HttpKernel\Debug\{closure}(object(GetResponseEvent))
at call_user_func(object(Closure), object(GetResponseEvent)) in /Users/whitebear/httproot/musics/app/cache/dev/classes.php line 3415
at EventDispatcher->doDispatch(array(object(Closure), object(Closure), object(Closure), object(Closure), object(Closure), object(Closure), object(Closure), object(Closure), object(Closure)), 'kernel.request', object(GetResponseEvent)) in /Users/whitebear/httproot/musics/app/cache/dev/classes.php line 3348
at EventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in /Users/whitebear/httproot/musics/app/cache/dev/classes.php line 3512
at ContainerAwareEventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in /Users/whitebear/httproot/musics/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php line 139
at TraceableEventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in /Users/whitebear/httproot/musics/app/bootstrap.php.cache line 992
at HttpKernel->handleRaw(object(Request), '1') in /Users/whitebear/httproot/musics/app/bootstrap.php.cache line 977
at HttpKernel->handle(object(Request), '1', true) in /Users/whitebear/httproot/musics/app/bootstrap.php.cache line 1103
at ContainerAwareHttpKernel->handle(object(Request), '1', true) in /Users/whitebear/httproot/musics/app/bootstrap.php.cache line 413
at Kernel->handle(object(Request)) in /Users/whitebear/httproot/musics/web/app_dev.php line 26
答案 0 :(得分:2)
实体短名称是Doctrine2使用的名称。如果Lesson
中有实体AcmeTeachBundle
(因此fqcn将为Acme\TeachBundle\Entity\Lesson
),则您的短名称为AcmeTeachBundle:Lesson
。