2016-01-31 119 views
0

我工作的前綴表上學說: Doctrine PrefixDoctrine2前綴和ZF2

,但我不知道是什麼$config是:

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

我發現:

$config = \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration(array(???)); 

但在我的例子中???是什麼。

謝謝你的幫助。

回答

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); 
+0

謝謝。我儘量嘗試。 – user2670354