5

我正在尝试将DoctrineExtension-Taggable集成到 Zend Framework 2 中。首先我添加到作曲家:

"anh/doctrine-extensions-taggable": "1.1.*@dev"

然后通过服务管理器(在 module.config.php 中)构建实例:

'service_manager' => array(
    'factories' => array(
        'taggableManager' => function($sm) {
            $entityManager = $sm->get('Doctrine\ORM\EntityManager');
            return new \Anh\Taggable\TaggableManager($entityManager, '\Anh\Taggable\Entity\Tag', '\Anh\Taggable\Entity\Tagging');
        },
       'taggableSubscriber' => function($sm) {
            $taggableManager = $sm->get('taggableManager');
            return new \Anh\Taggable\TaggableSubscriber($taggableManager);                                      
        },
    ),
 ),

创建实例后,我在 EventManager 中注册了订阅者:

'doctrine' => array(
    'driver' => array(
        // standart code for driver initialization
    ),
    'eventmanager' => array(
        'orm_default' => array(
            'subscribers' => array(
                'taggableSubscriber',
            ),
        ),
    ),
),

这就是我所做的一切。但是在这一步我有一个错误

致命错误:在 /var/www/html/fryday/vendor/zendframework/zendframework/library/Zend 中发现未捕获的异常“Zend\ServiceManager\Exception\CircularDependencyFoundException”和消息“LazyServiceLoader 的循环依赖项,例如 Doctrine\ORM\EntityManager” /ServiceManager/ServiceManager.php 第 946 行

我做错了什么?

4

0 回答 0