Permalink
Browse files

Using Doctrine\ORM\Tools\Setup for initialization

  • Loading branch information...
1 parent 98dff02 commit 0f25f8f0515fafb186badf4db62978ff260e39f9 @mariano committed Mar 22, 2012
Showing with 6 additions and 13 deletions.
  1. +0 −1 bin/doctrine-cli-config.php
  2. +6 −12 extensions/data/source/Doctrine.php
@@ -40,7 +40,6 @@
* Continue with doctrine cli config
*/
-require('Doctrine/ORM/Tools/Setup.php');
Doctrine\ORM\Tools\Setup::registerAutoloadGit(PLUGIN_PATH . '/_source/doctrine2');
$em = $connection->getEntityManager();
@@ -11,6 +11,7 @@
use Doctrine\ORM\Events;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\PreUpdateEventArgs;
+use Doctrine\ORM\Tools\Setup;
/**
* This datasource provides integration of Doctrine2 models
@@ -70,19 +71,12 @@ public function __construct(array $config = array()) {
* Initialize datasource
*/
protected function _init() {
- $this->configuration = new \Doctrine\ORM\Configuration();
- $this->configuration->setProxyDir($this->_config['proxies']);
- $this->configuration->setProxyNamespace(
- $this->_config['proxyNamespace']
+ $this->configuration = Setup::createAnnotationMetadataConfiguration(
+ (array) $this->_config['models'],
+ true,
+ $this->_config['proxies']
);
- $this->configuration->setMetadataCacheImpl(
- new \Doctrine\Common\Cache\ArrayCache()
- );
-
- $annotationDriver = $this->configuration->newDefaultAnnotationDriver(
- (array) $this->_config['models']
- );
- $this->configuration->setMetadataDriverImpl($annotationDriver);
+ $this->configuration->setProxyNamespace($this->_config['proxyNamespace']);
$this->eventManager = new \Doctrine\Common\EventManager();
$this->eventManager->addEventListener(array(

0 comments on commit 0f25f8f

Please sign in to comment.