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


PHP Setup::createYAMLMetadataConfiguration方法代码示例

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


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

示例1: __construct

 protected function __construct()
 {
     self::register_autoload();
     $connection_parameters = $this->get_connection_parameters();
     $this->config = Setup::createYAMLMetadataConfiguration(array($this->get_entity_path() . '/mapping'), true);
     $this->em = EntityManager::create($connection_parameters, $this->config);
 }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:7,代码来源:db.class.php

示例2: __construct

 /**
  * Initializes context.
  *
  * Every scenario gets its own context instance.
  * You can also pass arbitrary arguments to the
  * context constructor through behat.yml.
  */
 public function __construct()
 {
     $paths = [__DIR__ . '/../../config'];
     $databaseConfig = ['driver' => 'pdo_sqlite', 'path' => __DIR__ . '/../../db.sqlite'];
     $config = Setup::createYAMLMetadataConfiguration($paths, true);
     $this->entityManager = EntityManager::create($databaseConfig, $config);
 }
开发者ID:braddle,项目名称:blog-doctineEntityEvent,代码行数:14,代码来源:FeatureContext.php

示例3: 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

示例4: setUpEntityManager

 protected function setUpEntityManager($transformer = null)
 {
     $evm = new EventManager();
     $evm->addEventSubscriber($this->getSubscriber($transformer));
     $configuration = Setup::createYAMLMetadataConfiguration([__DIR__ . '/Fixture']);
     $this->em = $this->getMockSqliteEntityManager($evm, $configuration);
 }
开发者ID:mediamonks,项目名称:doctrine-extensions,代码行数:7,代码来源:TransformableYamlTest.php

示例5: createEntityManager

 /**
  * Create an EntityManager
  *
  * @return EntityManger
  */
 public static function createEntityManager()
 {
     $paths = [__DIR__ . '/yaml'];
     $isDevMode = true;
     $connectionConfig = ['driver' => 'pdo_sqlite', 'database' => ':memory:', 'prefix' => ''];
     $config = Setup::createYAMLMetadataConfiguration($paths, $isDevMode);
     return EntityManager::create($connectionConfig, $config);
 }
开发者ID:giadc,项目名称:json-api-request,代码行数:13,代码来源:EntityManagerFactory.php

示例6: connectMysql

 /**
  * Connects to the Redis node
  */
 protected function connectMysql()
 {
     $dbParams = array('driver' => 'pdo_mysql', 'user' => 'blockchain', 'password' => 'blockchain', 'dbname' => 'blockchain', 'host' => 'multichain-mysql.docker');
     $isDevMode = true;
     $paths = array("./yml/");
     $config = Setup::createYAMLMetadataConfiguration($paths, $isDevMode);
     $this->em = EntityManager::create($dbParams, $config);
 }
开发者ID:Kunstmaan,项目名称:hands-on-with-multichain,代码行数:11,代码来源:MysqlCommands.php

示例7: getEntityManager

 public static function getEntityManager()
 {
     if (static::$entityManager !== null) {
         return static::$entityManager;
     }
     $isDevMode = true;
     $config = Setup::createYAMLMetadataConfiguration(array(realpath(__DIR__ . "/../db")), $isDevMode);
     $arrConfig = parse_ini_file(__DIR__ . "/../config/voetbal.ini", true);
     return static::$entityManager = EntityManager::create($arrConfig["database"], $config);
 }
开发者ID:thepercival,项目名称:voetbal,代码行数:10,代码来源:commands.php

示例8: getEm

 /**
  * @return EntityManager
  */
 public function getEm()
 {
     // Basic configuration
     $isDev = true;
     $config = ['driver' => 'pdo_mysql', 'host' => 'localhost', 'user' => 'dev', 'password' => 'dev', 'dbname' => 'doctrine_tutorial'];
     // Paths to directories with entity metadata
     $metadata_paths = [__DIR__ . '/../src/Customer/mapping', __DIR__ . '/../src/Menu/mapping', __DIR__ . '/../src/Product/mapping'];
     $configuration = Setup::createYAMLMetadataConfiguration($metadata_paths, isset($isDev) ? $isDev : false);
     return EntityManager::create($config, $configuration);
 }
开发者ID:pgscandeias,项目名称:doctrine-tutorial,代码行数:13,代码来源:EntityManagerTestCase.php

示例9: __construct

 public function __construct()
 {
     require APPPATH . 'config/database.php';
     $dbParams = 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']));
     $isDevMode = true;
     $config = new Configuration();
     $setup = new Setup();
     $config = $setup->createAnnotationMetadataConfiguration(array(APPPATH . "models"), $isDevMode);
     $config = $setup->createYAMLMetadataConfiguration(array(APPPATH . "models/Yaml"), $isDevMode);
     $this->em = EntityManager::create($dbParams, $config);
 }
开发者ID:vinny-silveira,项目名称:codeigniter-doctrine-twig,代码行数:11,代码来源:Doctrine.php

示例10: register

 /**
  * Use the register method to register items with the container via the
  * protected $this->container property or the `getContainer` method
  * from the ContainerAwareTrait.
  *
  * @return void
  */
 public function register()
 {
     $config = Setup::createYAMLMetadataConfiguration(array(__DIR__ . "/../../../config/orm/"), $this->container->get('isDevMode'));
     $conn = array('driver' => 'pdo_sqlite', 'path' => __DIR__ . '/../../../db.sqlite');
     $this->entityManager = EntityManager::create($conn, $config);
     if (!Type::hasType("task_description")) {
         Type::addType('task_description', TaskDescription::class);
         $this->entityManager->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('description', 'task_description');
     }
     $this->getContainer()->add('entityManager', $this->entityManager);
     $this->getContainer()->add('JGimeno\\TaskReporter\\Entity\\WorkingDayRepositoryInterface', DoctrineWorkingDayRepository::class)->withArgument($this->entityManager);
 }
开发者ID:destebang,项目名称:taskreporter-1,代码行数:19,代码来源:RepositoryServiceProvider.php

示例11: GetEntityManager

function GetEntityManager()
{
    $paths = [realpath(__DIR__ . '/yml/')];
    $isDevMode = false;
    // the connection configuration
    $dbParams = ['driver' => 'pdo_sqlite', 'user' => 'root', 'password' => '', 'dbname' => 'foo', 'path' => ':memory:', 'memory' => 'true'];
    // $config instanceof Doctrine\ORM\Configuration
    $config = Setup::createYAMLMetadataConfiguration($paths, $isDevMode);
    $namespaces = [__DIR__ . '/yml/' => 'NilPortugues\\Tests\\Api\\JsonApi\\Integrations\\Doctrine\\Entity'];
    $driver = new SimplifiedYamlDriver($namespaces);
    $config->setMetadataDriverImpl($driver);
    //replace default driver
    return EntityManager::create($dbParams, $config);
}
开发者ID:nilportugues,项目名称:json-api,代码行数:14,代码来源:bootstrap.php

示例12: __construct

 public function __construct()
 {
     $isDev = config('app.dev');
     // Initialize template engine (Twig)
     $loader = new \Twig_Loader_Filesystem(config('view.path'));
     $this->twig = new \Twig_Environment($loader, ['debug' => $isDev, 'auto_reload' => $isDev, 'cache' => config('view.cache')]);
     // Initialize FormFactory with extensions required for app
     $this->formFactory = (new AppFormFactory($this->twig))->build();
     // Get request data
     $this->request = Request::createFromGlobals();
     // Initialize Doctrine EntityManager
     $config = Setup::createYAMLMetadataConfiguration([base_path("config/doctrine")], $isDev);
     $config->setQueryCacheImpl(new ApcCache());
     $config->setResultCacheImpl(new ApcCache());
     $conn = config('database');
     $this->em = EntityManager::create($conn, $config);
 }
开发者ID:pavgra,项目名称:2nova-test,代码行数:17,代码来源:Controller.php

示例13: beforeTestMethod

 public function beforeTestMethod($testMethod)
 {
     $this->mockGenerator->shuntParentClassCalls();
     $this->mockGenerator->orphanize('__construct');
     $pdo = new \mock\PDO();
     $this->mockGenerator->orphanize('__construct');
     $db = new \mock\Doctrine\DBAL\Connection();
     $db->getMockController()->connect = function () {
     };
     $db->getMockController()->getEventManager = function () {
         return new EventManager();
     };
     $db->getMockController()->getDatabasePlatform = function () {
         return new MySqlPlatform();
     };
     $this->mockGenerator->unshuntParentClassCalls();
     $config = Setup::createYAMLMetadataConfiguration([TEST_DATA_DIR . '/doctrine-orm'], true);
     $this->connection = EntityManager::create($db, $config);
 }
开发者ID:solire,项目名称:trieur,代码行数:19,代码来源:Contain.php

示例14: register

 public function register(Application $app)
 {
     $config = json_decode(file_get_contents(__DIR__ . '/../../config/parameters.json'), true);
     $conn = $config["orm.doctrine.db"];
     $paths = $config["orm.doctrine.yml.paths"];
     $debug = $config["debug"];
     $app['debug'] = $debug;
     $app['entity.manager'] = $app->share(function () use($conn, $paths, $debug) {
         $config = Setup::createYAMLMetadataConfiguration($paths, $debug);
         $config->addCustomNumericFunction('RANDOM', Random::class);
         return EntityManager::create($conn, $config);
     });
     $app['word.selector'] = $app->share(function () use($app) {
         $repository = $app['entity.manager']->getRepository(DoctrineWord::class);
         return new StoredWordSelector($repository);
     });
     $app['word.controller'] = $app->share(function () use($app) {
         return new WordController($app['word.selector']);
     });
 }
开发者ID:remi-san,项目名称:word-selector-app,代码行数:20,代码来源:WordServiceProvider.php

示例15: __construct

 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
     $dev_mode = true;
     // If you want to use a different metadata driver, change createAnnotationMetadataConfiguration
     // to createXMLMetadataConfiguration or createYAMLMetadataConfiguration.
     $config = Setup::createYAMLMetadataConfiguration($metadata_paths, $dev_mode, $proxies_dir);
     $this->em = EntityManager::create($connection_options, $config);
     $loader = new ClassLoader($models_namespace, $models_path);
     $loader->register();
 }
开发者ID:r-martins,项目名称:Ficha-Aberta,代码行数:22,代码来源:Doctrine.php


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