Doctrine2前缀和zf2

时间:2016-01-31 14:59:20

标签: doctrine-orm zend-framework2 prefix

我在Doctrine上处理前缀表: Doctrine Prefix

但我不知道null是什么:

$config

我发现:

$em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config, $evm);

但我的例子中$config = \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration(array( ??? )); 是什么。

谢谢你的帮助。

1 个答案:

答案 0 :(得分:0)

字段如下:

 * @param array   $paths
 * @param boolean $isDevMode
 * @param string  $proxyDir
 * @param Cache   $cache
 * @param bool    $useSimpleAnnotationReader

不确定这是否会有所帮助,但在做自定义工作时我总是这样做...

   use Doctrine\Common\EventManager;
   use Doctrine\DBAL\DriverManager;
   use Doctrine\ORM\EntityManager;
   use Doctrine\ORM\Tools\Setup;

   // Class definition and method ... {

    $params = 'orm_default' => array(
            'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
            'params' => array(
                'host'     => '127.0.0.1',
                'dbname'   => 'dbname',
                'user'     => 'myuser',
                'password' => 'mypass',
            ),
        );

    $eventManager = new EventManager();
    $config = Setup::createAnnotationMetadataConfiguration(array(), false, 'data/DoctrineORMModule/Proxy', null, false);
    $connection = DriverManager::getConnection($params,
                                               $config,
                                               $eventManager
    );
    $objectManager = EntityManager::create($connection, $config, $eventManager);