protected function setUp()
 {
     $params = array('driver' => 'pdo_mysql', 'host' => 'localhost', 'user' => 'root', 'password' => 'testmachine', 'dbname' => 'v_products_tests');
     $workspace = 'default';
     $user = '******';
     $pass = '******';
     $dbConn = \Doctrine\DBAL\DriverManager::getConnection($params);
     $parameters = array('jackalope.doctrine_dbal_connection' => $dbConn);
     /**
             $schema = RepositorySchema::create();
             foreach ($schema->toSql($dbConn->getDatabasePlatform()) as $sql) {
                 $dbConn->exec($sql);
             } */
     $repositoryFactory = new \Jackalope\RepositoryFactoryDoctrineDBAL();
     $repository = $repositoryFactory->getRepository($parameters);
     $credentials = new \PHPCR\SimpleCredentials(null, null);
     $session = $repository->login($credentials, $workspace);
     $locatorXml = new SymfonyFileLocator(array(__DIR__ . '/../../../lib/Vespolina/Product/Mapping' => 'Vespolina\\Entity\\Product', __DIR__ . '/../../../vendor/vespolina/pricing/lib/Vespolina/Pricing/Mapping' => 'Vespolina\\Entity\\Pricing', __DIR__ . '/../../../vendor/vespolina/taxonomy/lib/Vespolina/Taxonomy/Mapping' => 'Vespolina\\Entity\\Taxonomy'), '.phpcr.xml');
     $xmlDriver = new XmlDriver($locatorXml);
     $config = new \Doctrine\ODM\PHPCR\Configuration();
     $config->setMetadataDriverImpl($xmlDriver);
     $config->setMetadataCacheImpl(new ArrayCache());
     $config->setAutoGenerateProxyClasses(true);
     $documentManager = \Doctrine\ODM\PHPCR\DocumentManager::create($session, $config);
     $this->productGateway = new ProductDoctrinePHPCRGateway($documentManager, 'Vespolina\\Entity\\Product\\Product');
     $this->taxonomyGateway = new TaxonomyPHPCRGateway($documentManager, 'Vespolina\\Entity\\Taxonomy\\TaxonomyNode', '/');
     $this->taxonomyRootNode = $documentManager->find(null, '/');
     parent::setUp();
 }
 /**
  * Gets the 'doctrine_phpcr.odm.default_document_manager' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Doctrine\ODM\PHPCR\DocumentManager A Doctrine\ODM\PHPCR\DocumentManager instance.
  */
 protected function getDoctrinePhpcr_Odm_DefaultDocumentManagerService()
 {
     $a = $this->get('annotation_reader');
     $b = new \Doctrine\Common\Cache\ArrayCache();
     $b->setNamespace('sf2phpcr_default_8abfb5439f3e3c6366a9a2a7d225b51607df7dd909070cd38fddb5e661b6f197');
     $c = new \Doctrine\ODM\PHPCR\Mapping\Driver\AnnotationDriver($a, array(0 => $this->targetDirs[3] . '/vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Document', 1 => $this->targetDirs[3] . '/vendor/sonata-project/user-bundle/Document', 2 => $this->targetDirs[3] . '/src/Acme/BasicCmsBundle/Document', 3 => $this->targetDirs[3] . '/src/Application/Sonata/UserBundle/Document', 4 => $this->targetDirs[3] . '/vendor/doctrine/phpcr-odm/lib/Doctrine/ODM/PHPCR/Document'));
     $d = new \Doctrine\Common\Persistence\Mapping\Driver\SymfonyFileLocator(array($this->targetDirs[3] . '/vendor/symfony-cmf/routing-bundle/Resources/config/doctrine-model' => 'Symfony\\Cmf\\Bundle\\RoutingBundle\\Model', $this->targetDirs[3] . '/vendor/symfony-cmf/routing-bundle/Resources/config/doctrine-phpcr' => 'Symfony\\Cmf\\Bundle\\RoutingBundle\\Doctrine\\Phpcr'), '.phpcr.xml');
     $e = new \Doctrine\ODM\PHPCR\Mapping\Driver\XmlDriver($d);
     $f = new \Doctrine\Common\Persistence\Mapping\Driver\SymfonyFileLocator(array($this->targetDirs[3] . '/vendor/symfony-cmf/menu-bundle/Resources/config/doctrine-model' => 'Symfony\\Cmf\\Bundle\\MenuBundle\\Model', $this->targetDirs[3] . '/vendor/symfony-cmf/menu-bundle/Resources/config/doctrine-phpcr' => 'Symfony\\Cmf\\Bundle\\MenuBundle\\Doctrine\\Phpcr'), '.phpcr.xml');
     $g = new \Doctrine\ODM\PHPCR\Mapping\Driver\XmlDriver($f);
     $h = new \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain();
     $h->addDriver($c, 'FOS\\UserBundle\\Document');
     $h->addDriver($c, 'Sonata\\UserBundle\\Document');
     $h->addDriver($c, 'Acme\\BasicCmsBundle\\Document');
     $h->addDriver($c, 'Application\\Sonata\\UserBundle\\Document');
     $h->addDriver($c, 'Doctrine\\ODM\\PHPCR\\Document');
     $h->addDriver(new \Doctrine\ODM\PHPCR\Mapping\Driver\XmlDriver(new \Doctrine\Common\Persistence\Mapping\Driver\DefaultFileLocator(array(0 => $this->targetDirs[3] . '/vendor/symfony-cmf/routing-bundle/Resources/config/doctrine-base'), '.phpcr.xml')), 'Symfony\\Component\\Routing');
     $h->addDriver($e, 'Symfony\\Cmf\\Bundle\\RoutingBundle\\Model');
     $h->addDriver($e, 'Symfony\\Cmf\\Bundle\\RoutingBundle\\Doctrine\\Phpcr');
     $h->addDriver(new \Doctrine\ODM\PHPCR\Mapping\Driver\XmlDriver(new \Doctrine\Common\Persistence\Mapping\Driver\SymfonyFileLocator(array($this->targetDirs[3] . '/vendor/symfony-cmf/routing-auto-bundle/Resources/config/doctrine-model' => 'Symfony\\Cmf\\Bundle\\RoutingAutoBundle\\Model'), '.phpcr.xml')), 'Symfony\\Cmf\\Bundle\\RoutingAutoBundle\\Model');
     $h->addDriver($g, 'Symfony\\Cmf\\Bundle\\MenuBundle\\Model');
     $h->addDriver($g, 'Symfony\\Cmf\\Bundle\\MenuBundle\\Doctrine\\Phpcr');
     $i = new \Doctrine\ODM\PHPCR\Configuration();
     $i->setDocumentNamespaces(array('FOSUserBundle' => 'FOS\\UserBundle\\Document', 'SonataUserBundle' => 'Sonata\\UserBundle\\Document', 'AcmeBasicCmsBundle' => 'Acme\\BasicCmsBundle\\Document', 'ApplicationSonataUserBundle' => 'Application\\Sonata\\UserBundle\\Document', '__PHPCRODM__' => 'Doctrine\\ODM\\PHPCR\\Document'));
     $i->setMetadataCacheImpl($b);
     $i->setMetadataDriverImpl($h, false);
     $i->setProxyDir(__DIR__ . '/doctrine/PHPCRProxies');
     $i->setProxyNamespace('PHPCRProxies');
     $i->setAutoGenerateProxyClasses(true);
     $i->setClassMetadataFactoryName('Doctrine\\ODM\\PHPCR\\Mapping\\ClassMetadataFactory');
     $i->setDefaultRepositoryClassName('Doctrine\\ODM\\PHPCR\\DocumentRepository');
     $i->addDocumentNamespace('CmfRoutingBundle', 'Symfony\\Cmf\\Bundle\\RoutingBundle\\Doctrine\\Phpcr');
     $i->addDocumentNamespace('CmfRoutingAutoBundle', 'Symfony\\Cmf\\Bundle\\RoutingAutoBundle\\Model');
     $i->addDocumentNamespace('CmfMenuBundle', 'Symfony\\Cmf\\Bundle\\MenuBundle\\Doctrine\\Phpcr');
     $j = new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this);
     $j->addEventSubscriber($this->get('cmf_core.persistence.phpcr.non_translatable_metadata_listener'));
     $j->addEventListener(array(0 => 'postLoad', 1 => 'postPersist', 2 => 'postMove'), $this->get('cmf_routing.phpcrodm_route_idprefix_listener'));
     $j->addEventListener(array(0 => 'onFlush', 1 => 'endFlush'), $this->get('cmf_routing_auto.phpcrodm_auto_route_listener'));
     return $this->services['doctrine_phpcr.odm.default_document_manager'] = new \Doctrine\ODM\PHPCR\DocumentManager($this->get('doctrine_phpcr.default_session'), $i, $j);
 }
Exemplo n.º 3
0
 /**
  * Gets the 'doctrine_phpcr.odm.default_document_manager' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return Doctrine\ODM\PHPCR\DocumentManager A Doctrine\ODM\PHPCR\DocumentManager instance.
  */
 protected function getDoctrinePhpcr_Odm_DefaultDocumentManagerService()
 {
     $a = $this->get('annotation_reader');
     $b = new \Doctrine\Common\Cache\ArrayCache();
     $b->setNamespace('sf2phpcr_default_1f474d7255df8ad758b666714222d890');
     $c = new \Doctrine\ODM\PHPCR\Mapping\Driver\AnnotationDriver($a, array(0 => '/home/markus/development/php.labs/symfony/src/Mtol/TodoBundle/Document', 1 => '/home/markus/development/php.labs/symfony/vendor/doctrine/phpcr-odm/lib/Doctrine/ODM/PHPCR/Document'));
     $d = new \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain();
     $d->addDriver($c, 'Mtol\\TodoBundle\\Document');
     $d->addDriver($c, 'Doctrine\\ODM\\PHPCR\\Document');
     $e = new \Doctrine\ODM\PHPCR\Configuration();
     $e->setDocumentNamespaces(array('MtolTodoBundle' => 'Mtol\\TodoBundle\\Document', '__PHPCRODM__' => 'Doctrine\\ODM\\PHPCR\\Document'));
     $e->setMetadataCacheImpl($b);
     $e->setMetadataDriverImpl($d, false);
     $e->setProxyDir('/home/markus/development/php.labs/symfony/app/cache/dev/doctrine/PHPCRProxies');
     $e->setProxyNamespace('PHPCRProxies');
     $e->setAutoGenerateProxyClasses(true);
     return $this->services['doctrine_phpcr.odm.default_document_manager'] = new \Doctrine\ODM\PHPCR\DocumentManager($this->get('doctrine_phpcr.default_session'), $e, new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this));
 }