public function buildProdConfig()
 {
     $proxies = dirname(__FILE__) . DS . 'proxies';
     $config = Setup::createXMLMetadataConfiguration($this->paths, false, $proxies);
     $config->setProxyNamespace('Infrastructure\\Persistence\\Doctrine\\Proxies');
     return $config;
 }
예제 #2
0
 /**
  * Builds a container for a connection.
  *
  * @param mixed $connection Doctrine::DBAL connection
  * @return DoctrineBackendContainer
  */
 public static function buildByConnection($connection, $isDevMode = false)
 {
     $mappings = self::getXMLMappings();
     $config = Setup::createXMLMetadataConfiguration($mappings, $isDevMode);
     $entityManager = EntityManager::create($connection, $config);
     return new self($entityManager);
 }
예제 #3
0
파일: Mapper.php 프로젝트: uglybob/bh.net
 private function __construct()
 {
     $settings = Setup::getSettings();
     $config = \Doctrine\ORM\Tools\Setup::createXMLMetadataConfiguration([__DIR__ . '/../Mapper', 'Bh/Mapper'], $settings['DevMode']);
     $conn = array('driver' => 'pdo_mysql', 'user' => $settings['DbUser'], 'password' => $settings['DbPass'], 'dbname' => $settings['DbName']);
     self::$entityManager = \Doctrine\ORM\EntityManager::create($conn, $config);
 }
 protected function setUp()
 {
     $this->conn = $this->getSqliteConnection();
     $this->config = Setup::createXMLMetadataConfiguration(array(__DIR__ . '/_files'), true);
     $this->entityManager = EntityManager::create($this->conn, $this->config);
     $this->ormProvider = new OrmSchemaProvider($this->entityManager);
 }
예제 #5
0
 /**
  * This method is used to add an entity manager to the doctrine service.
  * @param $id string The id you would like to store with the entity manager.
  * @param ulfberht\module\doctrine\config $config The doctrine configuration for
  *        the entity manager.
  * @return void
  */
 public function addEntityManager($id, config $config)
 {
     $development = $config->develop ? true : false;
     $cache = $config->enableCache ? new ArrayCache() : null;
     //setup type of metadata reading
     switch ($config->type) {
         case 'annotation':
             $docConfig = Setup::createAnnotationMetadataConfiguration($config->paths, $development, null, $cache);
             break;
         case 'xml':
             $docConfig = Setup::createXMLMetadataConfiguration($config->paths, $development, null, $cache);
             break;
         case 'yaml':
             $docConfig = Setup::createYAMLMetadataConfiguration($config->paths, $development, null, $cache);
             break;
     }
     //setup caching
     if (!is_null($cache)) {
         $docConfig->setQueryCacheImpl($cache);
         $docConfig->setMetadataCacheImpl($cache);
     }
     //setup database connection
     $dbConnInfo = array('driver' => $config->database->driver, 'host' => $config->database->host, 'dbname' => $config->database->name, 'user' => $config->database->user, 'password' => $config->database->password);
     //store entity manager
     $this->_doctrineEntityMangers[$id] = EntityManager::create($dbConnInfo, $docConfig);
 }
예제 #6
0
 /**
  * Initializes the database (once).
  *
  * @throws \Doctrine\DBAL\DBALException
  * @throws \Doctrine\ORM\ORMException
  * @throws \Doctrine\ORM\Tools\ToolsException
  */
 protected function setUp()
 {
     if (null === static::$_conn) {
         $dbPath = __DIR__ . '/../../../db.sqlite';
         if (file_exists($dbPath)) {
             unlink($dbPath);
         }
         $params = ['driver' => 'pdo_sqlite', 'path' => $dbPath];
         static::$_conn = DriverManager::getConnection($params);
         static::$_conn->getConfiguration()->setSQLLogger(null);
     }
     if (null === static::$_em) {
         $paths = [__DIR__ . '/../../../../../src/Ekyna/Commerce/Bridge/Doctrine/ORM/Resources/mapping'];
         $isDevMode = true;
         $config = Setup::createXMLMetadataConfiguration($paths, $isDevMode);
         $em = EntityManager::create(static::$_conn, $config);
         $classes = [];
         foreach (static::$_classes as $class) {
             array_push($classes, $em->getClassMetadata($class));
         }
         $schemaTool = new SchemaTool($em);
         $schemaTool->dropSchema($classes);
         $schemaTool->createSchema($classes);
         // Load fixtures
         $loader = new Loader();
         $loader->loadFromDirectory(__DIR__ . '/../../../../../src/Ekyna/Commerce/Bridge/Doctrine/Fixtures');
         $purger = new ORMPurger();
         $executor = new ORMExecutor($em, $purger);
         $executor->execute($loader->getFixtures());
         static::$_em = $em;
     }
 }
 protected function setUp()
 {
     $config = Setup::createXMLMetadataConfiguration([__DIR__ . '/../src/Resources/doctrine'], true);
     $this->em = EntityManager::create(['driver' => 'pdo_sqlite', 'memory' => true], $config);
     $tool = new SchemaTool($this->em);
     $tool->createSchema($this->em->getMetadataFactory()->getAllMetadata());
     $this->repo = $this->em->getRepository(SimpleArticle::class);
 }
예제 #8
0
 private function getEntityManager()
 {
     $paths = array(Conf::getRootDir() . Conf::getDcotrineMappingsPath());
     $isDevMode = true;
     // the connection configuration
     $dbParams = array('driver' => Conf::getDBDriver(), 'user' => Conf::getDBUser(), 'password' => Conf::getDBPassword(), 'dbname' => Conf::getDBName(), 'host' => Conf::getDBHost(), 'port' => Conf::getDBPort());
     $configDoctrine = Setup::createXMLMetadataConfiguration($paths, $isDevMode);
     return EntityManager::create($dbParams, $configDoctrine);
 }
 /**
  * Register the binding
  *
  * @return void
  */
 public function register()
 {
     \App::singleton('Doctrine\\ORM\\EntityManager', function () {
         $isDevMode = true;
         $paths = array(__DIR__ . '/Infrastructure/Repository/Metadata');
         $config = Setup::createXMLMetadataConfiguration($paths, $isDevMode);
         $conn = array('driver' => 'pdo_mysql', 'host' => 'localhost', 'dbname' => 'laravelddd', 'user' => 'root', 'password' => 'root');
         return \Doctrine\ORM\EntityManager::create($conn, $config);
     });
 }
예제 #10
0
 protected function getEntityManager(array $metadata)
 {
     if (!$this->entityManager) {
         $config = Setup::createXMLMetadataConfiguration($metadata, true, TESTS_DOCTRINE_PROXY_DIR);
         //$conn = array('driver' => 'pdo_sqlite', 'path' =>  __DIR__ . '/db/test.db');
         $conn = array('driver' => 'pdo_sqlite', 'memory' => true);
         $this->entityManager = EntityManager::create($conn, $config);
     }
     return $this->entityManager;
 }
예제 #11
0
 /**
  * Establish a connection to the database using the following.
  * @param  array  $connectionParams An array of parameters that establishes a connection.
  * @return self
  */
 public function establishConnection(array $connectionParams)
 {
     $paths = [__DIR__ . '/ORM/Config'];
     $isDevMode = false;
     $config = Setup::createXMLMetadataConfiguration($paths, $isDevMode);
     $this->entityManager = EntityManager::create($connectionParams, $config);
     $this->quizzes = $this->entityManager->getRepository('Quizzes\\Quiz');
     $this->questions = $this->entityManager->getRepository('Quizzes\\Question');
     $this->answers = $this->entityManager->getRepository('Quizzes\\Answer');
     return $this;
 }
예제 #12
0
파일: model.php 프로젝트: aidenfoxx/foxxmvc
 protected static function getDB()
 {
     if (!self::$entityManager) {
         $dbConfig = Config::getInstance()->getValues('db');
         $db = array('driver' => 'pdo_mysql', 'host' => $dbConfig->DB_HOST . ':' . $dbConfig->DB_PORT, 'user' => $dbConfig->DB_USER, 'password' => $dbConfig->DB_PASS, 'dbname' => $dbConfig->DB_NAME);
         $doctrineConfig = Setup::createXMLMetadataConfiguration(array(DIR_CACHE . '/doctrine'), $dbConfig->DB_DEV);
         self::$entityManager = EntityManager::create($db, $doctrineConfig);
         self::$entityManager->getConnection()->connect();
     }
     return self::$entityManager;
 }
예제 #13
0
 /**
  * @return EntityManager
  */
 public static function getEm($dbParams = array())
 {
     if (is_null(self::$em)) {
         $paths[] = dirname(__DIR__) . '/resources/config/xml';
         $isDevMode = false;
         // the connection configuration
         $dbParams += array('driver' => 'pdo_mysql', 'user' => 'root', 'password' => '', 'dbname' => 'foo');
         $config = Setup::createXMLMetadataConfiguration($paths, $isDevMode);
         self::$em = EntityManager::create($dbParams, $config);
     }
     return self::$em;
 }
예제 #14
0
 /**
  * Create Doctrine configuration.
  *
  * @param array $options
  *
  * @return \Doctrine\ORM\Configuration|null
  */
 protected static function createConfiguration(array $options)
 {
     if ($options['annotation_paths']) {
         return Setup::createAnnotationMetadataConfiguration(static::normalizePaths($options['annotation_paths']), false, $options['proxy_path'], $options['cache_driver'], false);
     }
     if ($options['xml_paths']) {
         return Setup::createXMLMetadataConfiguration(static::normalizePaths($options['xml_paths']), false, $options['proxy_path'], $options['cache_driver']);
     }
     if ($options['yaml_paths']) {
         return Setup::createYAMLMetadataConfiguration(static::normalizePaths($options['yaml_paths']), false, $options['proxy_path'], $options['cache_driver']);
     }
     return null;
 }
 /**
  * Register Doctrine's entity manager
  *
  * @param Container $container
  */
 public function register(Container $container)
 {
     $container['doctrine.em'] = function () use($container) {
         $configuration = Setup::createXMLMetadataConfiguration($container['doctrine']['mapping_dirs'], $container['doctrine']['dev_mode'], $container['doctrine']['proxy_dir']);
         $entityManager = EntityManager::create($container['doctrine']['connection'], $configuration);
         $platform = $entityManager->getConnection()->getDatabasePlatform();
         foreach ($container['doctrine']['types'] as $type => $class) {
             !Type::hasType($type) && Type::addType($type, $class);
             $platform->registerDoctrineTypeMapping($type, $type);
         }
         return $entityManager;
     };
 }
예제 #16
0
 private function loadOrm()
 {
     $this['psi_content_type.storage.doctrine.orm.field_mapper'] = function ($container) {
         return new FieldMapper($container['psi_content_type.field_loader']);
     };
     $this['doctrine.entity_manager'] = function ($container) {
         $dbParams = ['driver' => 'pdo_sqlite', 'path' => $this['config']['db_path']];
         $paths = [__DIR__ . '/mappings'];
         $config = Setup::createXMLMetadataConfiguration($paths, true);
         $manager = EntityManager::create($dbParams, $config);
         $manager->getEventManager()->addEventSubscriber(new MetadataSubscriber($container['psi_content_type.metadata.factory'], $container['psi_content_type.field_loader'], $container['psi_content_type.storage.doctrine.orm.field_mapper']));
         return $manager;
     };
 }
예제 #17
0
파일: Doctrine.php 프로젝트: TheHexa1/AMS
 public function __construct()
 {
     require_once __DIR__ . '/Doctrine/ORM/Tools/Setup.php';
     Setup::registerAutoloadDirectory(__DIR__);
     // Load the database configuration from CodeIgniter
     require APPPATH . 'config/database.php';
     $connection_options = array('driver' => 'pdo_mysql', 'user' => $db['default']['username'], 'password' => $db['default']['password'], 'host' => $db['default']['hostname'], 'dbname' => $db['default']['database'], 'charset' => $db['default']['char_set'], 'driverOptions' => array('charset' => $db['default']['char_set']));
     // With this configuration, your model files need to be in application/models/Entity
     // e.g. Creating a new Entity\User loads the class from application/models/Entity/User.php
     $models_namespace = 'Entity';
     $models_path = APPPATH . 'models';
     $proxies_dir = APPPATH . 'models/Proxies';
     $metadata_paths = array(APPPATH . 'models');
     // Set $dev_mode to TRUE to disable caching while you develop
     $config = Setup::createXMLMetadataConfiguration($metadata_paths, $dev_mode = true, $proxies_dir);
     $this->em = EntityManager::create($connection_options, $config);
     $loader = new ClassLoader($models_namespace, $models_path);
     $loader->register();
 }
 /**
  * Registers services on the given app.
  *
  * This method should only be used to configure services and parameters.
  * It should not get services.
  */
 public function register(Application $app)
 {
     $app['orm.default_options'] = array('params' => array('charset' => null, 'driver' => 'pdo_mysql', 'dbname' => null, 'host' => 'localhost', 'user' => 'root', 'password' => null, 'port' => null), 'dev_mode' => false, 'etities_type' => 'annotations', 'path_entities' => array(__DIR__ . '/../../Application/Entity'), 'proxy_dir' => null);
     $app['orm.options.initializer'] = $app->protect(function () use($app) {
         static $initialized = false;
         if ($initialized) {
             return;
         }
         $initialized = true;
         $tmp = array();
         foreach ($app['orm.default_options'] as $name => $option) {
             $tmp[$name] = isset($app[$name]) ? $app[$name] : $option;
         }
         $app['orm.options'] = $tmp;
     });
     // ORM
     $app['orm.em'] = $app->share(function ($app) {
         $app['orm.options.initializer']();
         $options = $app['orm.options'];
         if (empty($options['path_entities']) || !is_array($options['path_entities'])) {
             throw new \Exception('Option path_entities should be an array of path files entities.');
         }
         if ($options['etities_type'] == 'annotations') {
             $config = Setup::createAnnotationMetadataConfiguration($options['path_entities'], $options['dev_mode'], $options['proxy_dir']);
         } elseif ($options['etities_type'] == 'yaml' || $options['etities_type'] == 'yml') {
             $config = Setup::createYAMLMetadataConfiguration($options['path_entities'], $options['dev_mode'], $options['proxy_dir']);
         } elseif ($options['etities_type'] == 'xml') {
             $config = Setup::createXMLMetadataConfiguration($options['path_entities'], $options['dev_mode'], $options['proxy_dir']);
         }
         if (isset($app['db'])) {
             $entityManager = EntityManager::create($app['db'], $config);
         } else {
             $entityManager = EntityManager::create($options['params'], $config);
             $app['db'] = $entityManager->getConnection();
         }
         return $entityManager;
     });
 }
예제 #19
0
 /**
  * DatabaseManager constructor.
  * @param $connectionSettings array Connection details
  * @param $mappingsDirectory string Path to directory where the mappings stored
  * @throws \Doctrine\ORM\ORMException
  * @throws \Exception
  */
 public function __construct($connectionSettings, $mappingsDirectory)
 {
     // First Step: Convert settings to doctrine params
     $connectionParams = array();
     if ($connectionSettings['type'] == 'mysql') {
         $connectionParams['dbname'] = $connectionSettings['database'];
         $connectionParams['user'] = $connectionSettings['username'];
         $connectionParams['password'] = $connectionSettings['password'];
         $connectionParams['host'] = $connectionSettings['server'];
         $connectionParams['driver'] = 'pdo_mysql';
     } else {
         if ($connectionSettings['type'] == 'sqlite') {
             $connectionParams['path'] = $connectionSettings['path'];
             $connectionParams['driver'] = 'pdo_sqlite';
         } else {
             throw new \Exception("Unknown database type '" . $connectionSettings['type'] . "'");
         }
     }
     // Second Step: Create configuration
     $this->config = Setup::createXMLMetadataConfiguration(array($mappingsDirectory), true);
     // Third Step: Create a connection (EntityManager)
     $this->entityManager = EntityManager::create($connectionParams, $this->config);
 }
예제 #20
0
 public function __invoke()
 {
     $configuration = $this->configuration->toDiArray();
     $configuration[EntityManager::class] = \DI\factory(function () {
         $isDevMode = \DI\link('doctrine.debug');
         $metadataConfiguration = \DI\link('doctrine.metadata.configuration');
         $paths = $metadataConfiguration['paths'];
         switch ($metadataConfiguration['type']) {
             case 'xml':
                 $metadata = Setup::createXMLMetadataConfiguration($paths, $isDevMode);
                 break;
             case 'yml':
                 $metadata = Setup::createYAMLMetadataConfiguration($paths, $isDevMode);
                 break;
             case 'annotations':
                 $metadata = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
                 break;
             default:
                 throw new \InvalidArgumentException('Doctrine can only load its configuration using "xml", "yml" or "annotations" but "' . $metadataConfiguration['type'] . '" was provided as a means.');
         }
         return EntityManager::create(\DI\link('doctrine.connection'), $metadata);
     });
     return $configuration;
 }
 /**
  * Register the properties of the Doctrine ORM Provider
  * 
  * @access public
  * @param MVC $mvc
  * @return void
  */
 public function register(MVC $mvc)
 {
     $default_options = array('params' => array('charset' => null, 'driver' => 'pdo_mysql', 'dbname' => null, 'host' => 'localhost', 'user' => 'root', 'password' => null, 'port' => null), 'dev_mode' => false, 'etities_type' => 'annotations', 'path_entities' => array(), 'proxy_dir' => null);
     $options = array_merge($default_options, $this->options);
     if (empty($options['path_entities']) || !is_array($options['path_entities'])) {
         throw new \Exception('Option path_entities should be an array of path files entities.');
     }
     if ($options['etities_type'] == 'annotations') {
         $config = Setup::createAnnotationMetadataConfiguration($options['path_entities'], $options['dev_mode'], $options['proxy_dir']);
     } elseif ($options['etities_type'] == 'yaml' || $options['etities_type'] == 'yml') {
         $config = Setup::createYAMLMetadataConfiguration($options['path_entities'], $options['dev_mode'], $options['proxy_dir']);
     } elseif ($options['etities_type'] == 'xml') {
         $config = Setup::createXMLMetadataConfiguration($options['path_entities'], $options['dev_mode'], $options['proxy_dir']);
     }
     if ($mvc->hasCvpp('dbal')) {
         $entityManager = EntityManager::create($mvc->getCvpp('dbal'), $config);
     } else {
         $entityManager = EntityManager::create($options['params'], $config);
     }
     if (!$mvc->hasCvpp('dbal')) {
         $mvc->setCvpp('dbal', $entityManager->getConnection());
     }
     $mvc->setCvpp('em', $entityManager);
 }
 /**
  * Creates the metadata configuration instance.
  *
  * @param string $type
  * @param array  $paths
  * @param bool   $isDevMode
  * @param string $proxyDir
  * @param Cache  $cache
  * @param bool   $useSimpleAnnotationReader
  *
  * @return Configuration
  * @throws \Exception
  */
 protected function createMetadataConfiguration($type, $paths, $isDevMode, $proxyDir, $cache, $useSimpleAnnotationReader = true)
 {
     switch ($type) {
         case self::METADATA_ANNOTATIONS:
             return Setup::createAnnotationMetadataConfiguration($paths, $isDevMode, $proxyDir, $cache, $useSimpleAnnotationReader);
         case self::METADATA_XML:
             return Setup::createXMLMetadataConfiguration($paths, $isDevMode, $proxyDir, $cache);
         case self::METADATA_YAML:
             return Setup::createYAMLMetadataConfiguration($paths, $isDevMode, $proxyDir, $cache);
         default:
             throw new Exception("Metadata type '{$type}' is not supported.");
     }
 }
예제 #23
0
 } catch (Yaml\Exception\ParseException $e) {
     throw new \Exception($e->getMessage());
 }
 $config = Arr::merge($config, $configEnv);
 //print_r( $config );
 $entityManager = NULL;
 $dbParams = Arr::get($config, 'doctrine.database', []);
 $mappingType = strtolower(Arr::get($config, 'doctrine.mapping.type', 'xml'));
 $paths = Arr::get($config, 'doctrine.mapping.paths', []);
 $mappingPaths = [];
 foreach ($paths as $path) {
     $mappingPaths[] = realpath($path);
 }
 switch ($mappingType) {
     case 'xml':
         $xmlConfig = Setup::createXMLMetadataConfiguration($mappingPaths, $env == 'dev');
         $entityManager = EntityManager::create($dbParams, $xmlConfig);
         break;
     case 'yml':
     case 'yaml':
         //$driver = new YamlDriver( $mappingPaths );
         //$driver->setFileExtension('.yml');
         $ymlConfig = Setup::createYAMLMetadataConfiguration($mappingPaths, $env == 'dev');
         //$ymlConfig->setMetadataDriverImpl( $driver );
         $entityManager = EntityManager::create($dbParams, $ymlConfig);
         break;
     case 'annotation':
         $annotationConfig = Setup::createAnnotationMetadataConfiguration($mappingPaths, $env == 'dev');
         $entityManager = EntityManager::create($dbParams, $annotationConfig);
         break;
     default:
예제 #24
0
 /**
  * @return \Doctrine\ORM\Configuration|mixed
  */
 public function resolve()
 {
     return Setup::createXMLMetadataConfiguration(array_get($this->settings, 'paths'), array_get($this->settings, 'dev'), array_get($this->settings, 'proxy_path'), $this->getCache());
 }
예제 #25
0
 public function __construct($config)
 {
     $setUp = Setup::createXMLMetadataConfiguration([__DIR__ . self::XML_CONFIG_ORM], true);
     $this->mapper = new Doctrine($config, $setUp);
 }
예제 #26
0
파일: SetupTest.php 프로젝트: rfc1483/padel
 public function testXMLConfiguration()
 {
     $config = Setup::createXMLMetadataConfiguration(array(), true);
     $this->assertInstanceOf('Doctrine\\ORM\\Configuration', $config);
     $this->assertInstanceOf('Doctrine\\ORM\\Mapping\\Driver\\XmlDriver', $config->getMetadataDriverImpl());
 }
예제 #27
0
파일: CliTest.php 프로젝트: pavsuri/PARMT
 public function testMigrationDiffWithEntityManagerGeneratesMigrationFromEntities()
 {
     $config = OrmSetup::createXMLMetadataConfiguration(array(__DIR__ . '/_files/entities'), true);
     $entityManager = EntityManager::create($this->conn, $config);
     $this->application->getHelperSet()->set(new EntityManagerHelper($entityManager), 'em');
     $this->withDiffCommand();
     $this->assertVersionCount(0, 'should start with no versions');
     $this->executeCommand('migrations:diff');
     $this->assertSuccessfulExit();
     $this->assertVersionCount(1, 'diff command should add one version');
     $output = $this->executeCommand('migrations:status');
     $this->assertSuccessfulExit();
     $this->assertRegExp('/available migrations:\\s+2$/im', $output);
     $versions = $this->globVersions();
     $contents = file_get_contents($versions[0]);
     $this->assertContains('CREATE TABLE sample_entity', $contents);
     $this->assertContains('DROP TABLE sample_entity', $contents);
 }
예제 #28
0
<?php

$ormCache = new \Doctrine\Common\Cache\ArrayCache();
$entityManagerConfig = \Doctrine\ORM\Tools\Setup::createXMLMetadataConfiguration(array(__DIR__ . "/orm"), false, __DIR__ . "/orm/proxy", $ormCache);
$entityManagerConfig->setAutoGenerateProxyClasses(\Doctrine\Common\Proxy\AbstractProxyFactory::AUTOGENERATE_ALWAYS);
$entityManagerConfig->setMetadataCacheImpl($ormCache);
//$entityManagerConfig->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger());
$entityManager = \Doctrine\ORM\EntityManager::create(array('driver' => 'pdo_mysql', 'user' => 'root', 'password' => 'admin', 'dbname' => 'sample', 'host' => '127.0.0.1', 'connection' => array('compress' => 'true'), 'driverOptions' => array(1002 => 'SET NAMES utf8')), $entityManagerConfig);
$entityManager->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
예제 #29
0
<?php

/**
 * Created by PhpStorm.
 * User: Arthur
 * Date: 30/09/2015
 * Time: 07:38
 */
use src\controllers\CommonController;
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
require_once "vendor/autoload.php";
$isDevMode = true;
$config = Setup::createXMLMetadataConfiguration(array(__DIR__ . "/src/xml"), $isDevMode);
$connectionParams = array('dbname' => 'audio', 'user' => 'root', 'password' => '', 'host' => 'localhost', 'driver' => 'pdo_mysql');
$conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
$entityManager = EntityManager::create($conn, $config);
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem('./src/views');
$twig = new Twig_Environment($loader, array('cache' => false));
CommonController::Initialize($twig, $entityManager);
예제 #30
0
 /**
  * @param array $mappingConfig
  * @param array $proxyConfig
  * @param bool $onProduction
  * @param Cache $cache
  * @return \Doctrine\ORM\Configuration
  */
 public function configureDriver(array $mappingConfig, array $proxyConfig, $onProduction = true, Cache $cache = null)
 {
     return Setup::createXMLMetadataConfiguration($mappingConfig['path'], $onProduction, $proxyConfig['path'], $cache);
 }