예제 #1
0
 public function getConnection()
 {
     $this->em = EntityManagerFactory::createEntityManager(__DIR__ . '/../../../../app/config/parameters_test.yml', __DIR__ . '/../../../../src', false);
     // Retrieve PDO instance
     $pdo = $this->em->getConnection()->getWrappedConnection();
     // Clear Doctrine to be safe
     $this->em->clear();
     // Schema Tool to process our entities
     $tool = new SchemaTool($this->em);
     $classes = $this->em->getMetaDataFactory()->getAllMetaData();
     // Drop all classes and re-build them for each test case
     $tool->dropSchema($classes);
     $tool->createSchema($classes);
     // Pass to PHPUnit
     return $this->createDefaultDBConnection($pdo, 'angular_cms_test');
 }
예제 #2
0
<?php

require_once "vendor/autoload.php";
use Doctrine\Common\Annotations\AnnotationRegistry;
use rmatil\cms\Utils\EntityManagerFactory;
// If $isDevMode is true caching is done in memory with the ArrayCache. Proxy objects are recreated on every request.
$devMode = true;
// register annotations of jms serializer
AnnotationRegistry::registerAutoloadNamespace('JMS\\Serializer\\Annotation', __DIR__ . '/vendor/jms/serializer/src');
$entityManager = EntityManagerFactory::createEntityManager(__DIR__ . '/app/config/parameters.yml', __DIR__ . '/src', $devMode);