1

嗨,zend 框架 2 + 学说 2 和 DoctrineDataFixtureModule( https://github.com/Hounddog/DoctrineDataFixtureModule )有一些问题,模块没有加载我的装置这是我的配置

'doctrine' => array(
    'eventmanager' => array(
        'orm_default' => array(
            'subscribers' => array(

                'Gedmo\Tree\TreeListener',
                'Gedmo\Timestampable\TimestampableListener',
                'Gedmo\Sluggable\SluggableListener',
                'Gedmo\Loggable\LoggableListener',
                'Gedmo\Sortable\SortableListener'
            ),
        ),
    ),
     'driver' => array(

          __NAMESPACE__.'_driver' => array(
          'class' =>'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
          'cache' => 'array',
          'paths' => array(
            __DIR__ . '/../src/'.__NAMESPACE__.'/Entity',

            )
          'data-fixture' => array(
             __NAMESPACE__.'_fixture' =>  __DIR__ . '/../src/'.__NAMESPACE__.'/Fixtures',
          ),
        ),

        'translatable_metadata_driver' => array(
            'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
            'cache' => 'array',
            'paths' => array(
                'vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity',
            ),
        ),
        'orm_default' => array(
          'drivers' => array(
            __NAMESPACE__.'\Entity' => __NAMESPACE__.'_driver',
          //  'Gedmo\Translatable\Entity' => 'translatable_metadata_driver',
          )
        ),
    )

),问题是我不知道如何设置夹具路径或数组中的确切键我必须在开发人员说的文档中设置夹具路径:

要使用 Doctrine 模块注册驱动程序,只需将驱动程序添加到配置中的教义.driver 键。

return array(
'data-fixture' => array(
    'ModuleName_fixture' => __DIR__ . '/../src/ModuleName/Fixture',
),

);

4

1 回答 1

2

您实际上需要将数组添加data-fixture到配置数组的根目录,而不是doctrine数组中。像这样:

return array(
...
    'doctrine' => array(
        'eventmanager' => array(
            'orm_default' => array(
                'subscribers' => array(

                    'Gedmo\Tree\TreeListener',
                    'Gedmo\Timestampable\TimestampableListener',
                    'Gedmo\Sluggable\SluggableListener',
                    'Gedmo\Loggable\LoggableListener',
                    'Gedmo\Sortable\SortableListener'
                ),
            ),
        ),
        'driver' => array(

            __NAMESPACE__.'_driver' => array(
                'class' =>'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
                'cache' => 'array',
                'paths' => array(
                    __DIR__ . '/../src/'.__NAMESPACE__.'/Entity',

                )
            ),

            'translatable_metadata_driver' => array(
                'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
                'cache' => 'array',
                'paths' => array(
                    'vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity',
                ),
            ),
            'orm_default' => array(
                'drivers' => array(
                    __NAMESPACE__.'\Entity' => __NAMESPACE__.'_driver',
//  'Gedmo\Translatable\Entity' => 'translatable_metadata_driver',
                )
            ),
        )
    ),
    'data-fixture' => array(
        __NAMESPACE__.'_fixture' =>  __DIR__ . '/../src/'.__NAMESPACE__.'/Fixtures',
    ),
...
);

我承认文档中的措辞有点混乱。

于 2013-08-03T17:13:23.757 回答