当前位置: 首页>>代码示例>>PHP>>正文


PHP Setup::createXMLMetadataConfiguration方法代码示例

本文整理汇总了PHP中Doctrine\ORM\Tools\Setup::createXMLMetadataConfiguration方法的典型用法代码示例。如果您正苦于以下问题:PHP Setup::createXMLMetadataConfiguration方法的具体用法?PHP Setup::createXMLMetadataConfiguration怎么用?PHP Setup::createXMLMetadataConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\ORM\Tools\Setup的用法示例。


在下文中一共展示了Setup::createXMLMetadataConfiguration方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildProdConfig

 public function buildProdConfig()
 {
     $proxies = dirname(__FILE__) . DS . 'proxies';
     $config = Setup::createXMLMetadataConfiguration($this->paths, false, $proxies);
     $config->setProxyNamespace('Infrastructure\\Persistence\\Doctrine\\Proxies');
     return $config;
 }
开发者ID:r3laXcode,项目名称:php-classic-blog,代码行数:7,代码来源:ConfigurationFactory.php

示例2: buildByConnection

 /**
  * 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);
 }
开发者ID:bmdevel,项目名称:bav,代码行数:13,代码来源:DoctrineBackendContainer.php

示例3: __construct

 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);
 }
开发者ID:uglybob,项目名称:bh.net,代码行数:7,代码来源:Mapper.php

示例4: setUp

 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);
 }
开发者ID:rvdbogerd,项目名称:migrations,代码行数:7,代码来源:OrmSchemaProviderTest.php

示例5: addEntityManager

 /**
  * 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);
 }
开发者ID:ua1-labs,项目名称:ulfberht-application,代码行数:33,代码来源:doctrine.php

示例6: setUp

 /**
  * 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;
     }
 }
开发者ID:ekyna,项目名称:commerce,代码行数:39,代码来源:DatabaseTestCase.php

示例7: setUp

 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);
 }
开发者ID:AgencyPMG,项目名称:ThreeRepositories,代码行数:8,代码来源:DoctrineArticleRepositoryTest.php

示例8: getEntityManager

 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);
 }
开发者ID:HiNxPeR,项目名称:phpapit20151cz,代码行数:9,代码来源:DAOFactory.php

示例9: register

 /**
  * 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);
     });
 }
开发者ID:svenhartmann,项目名称:laravel-ddd,代码行数:15,代码来源:MyAppServiceProvider.php

示例10: getEntityManager

 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;
 }
开发者ID:siad007,项目名称:ctrllib,代码行数:10,代码来源:DbTestCase.php

示例11: establishConnection

 /**
  * 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;
 }
开发者ID:WillSkates,项目名称:Quizzes,代码行数:16,代码来源:ConnectionTrait.php

示例12: getDB

 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;
 }
开发者ID:aidenfoxx,项目名称:foxxmvc,代码行数:11,代码来源:model.php

示例13: getEm

 /**
  * @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;
 }
开发者ID:andytruong,项目名称:vclang,代码行数:15,代码来源:bootstrap.php

示例14: createConfiguration

 /**
  * 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;
 }
开发者ID:nogo,项目名称:slim-doctrine,代码行数:20,代码来源:EntityManagerBuilder.php

示例15: register

 /**
  * 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;
     };
 }
开发者ID:zoek1,项目名称:php-testing-tools,代码行数:18,代码来源:DoctrineServiceProvider.php


注:本文中的Doctrine\ORM\Tools\Setup::createXMLMetadataConfiguration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。