0

我打算制作调度程序日历。所以我拿起了calendR。

在此页面上的说明的指导下,我安装了frequence-web/calendr-bundle

然后我想将 CalendR 与 Doctrine 一起使用。我添加了这个:

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:未知实体命名空间别名“课程”

我的堆栈跟踪如下。

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
4

1 回答 1

2

实体短名称是 Doctrine2 使用的名称。如果你有一个实体(所以 fqcn 将是),你Lesson的简称是.AcmeTeachBundleAcme\TeachBundle\Entity\LessonAcmeTeachBundle:Lesson

于 2013-06-07T21:34:00.727 回答