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


PHP EntityManagerInterface::getMetadataFactory方法代码示例

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


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

示例1: fire

 public function fire()
 {
     $this->info('Starting proxy generation....');
     // flush all generated and cached entities, etc
     \D2Cache::flushAll();
     try {
         $metadata = $this->d2em->getMetadataFactory()->getAllMetadata();
     } catch (\Doctrine\Common\Persistence\Mapping\MappingException $e) {
         if ($this->option('verbose') == 3) {
             throw $e;
         }
         $this->error("Caught Doctrine\\Common\\Persistence\\Mapping\\MappingException: " . $e->getMessage());
         $this->info("Re-optimizing:");
         $this->call('optimize');
         $this->comment("*** You must now rerun this artisan command ***");
         exit(-1);
     }
     if (empty($metadata)) {
         $this->error('No metadata found to generate entities.');
         return -1;
     }
     $directory = Config::get('d2doctrine.paths.proxies');
     if (!$directory) {
         $this->error('The proxy directory has not been set.');
         return -1;
     }
     $this->info('Processing entities:');
     foreach ($metadata as $item) {
         $this->line($item->name);
     }
     $this->d2em->getProxyFactory()->generateProxyClasses($metadata, $directory);
     $this->info('Proxies have been created.');
 }
开发者ID:jeanbelhache,项目名称:doctrine2-l5,代码行数:33,代码来源:Proxies.php

示例2: createDoctrineSchema

 /**
  * Creates schema for doctrine entities
  *
  * @throws \Doctrine\ORM\Tools\ToolsException
  */
 protected function createDoctrineSchema()
 {
     $metadata = $this->entityManager->getMetadataFactory()->getAllMetadata();
     $tool = new SchemaTool($this->entityManager);
     $tool->dropSchema($metadata);
     $tool->createSchema($metadata);
 }
开发者ID:silversolutions,项目名称:content-loader-bundle,代码行数:12,代码来源:DatabaseSchemaCreator.php

示例3: rebuildDatabase

 /**
  * Builds the DB Schema
  *
  * @return void
  */
 protected function rebuildDatabase()
 {
     # 2. Drop the existing database schema
     $this->schemaTool->dropDatabase();
     # 3. Create the new database schema based on (1)
     $entityMeta = $this->em->getMetadataFactory()->getAllMetadata();
     $this->schemaTool->updateSchema($entityMeta);
 }
开发者ID:jtallant,项目名称:skimpy-engine,代码行数:13,代码来源:Populator.php

示例4: createSchema

 /**
  * {@inheritdoc}
  */
 public function createSchema()
 {
     $metadata = $this->entityManager->getMetadataFactory()->getAllMetadata();
     if (empty($metadata)) {
         throw new \UnexpectedValueException('No mapping information to process');
     }
     $tool = new SchemaTool($this->entityManager);
     return $tool->getSchemaFromMetadata($metadata);
 }
开发者ID:Dren-x,项目名称:mobitnew,代码行数:12,代码来源:OrmSchemaProvider.php

示例5: generateSchema

 public function generateSchema()
 {
     $metadatas = $this->em->getMetadataFactory()->getAllMetadata();
     if (!empty($metadatas)) {
         $tool = new \Doctrine\ORM\Tools\SchemaTool($this->om);
         $tool->dropDatabase();
         $tool->dropSchema($metadatas);
         $tool->createSchema($metadatas);
     }
 }
开发者ID:fvilpoix,项目名称:php-common,代码行数:10,代码来源:DatabaseTools.php

示例6: __construct

 /**
  * Initializes a new instance of the <tt>ProxyFactory</tt> class that is
  * connected to the given <tt>EntityManager</tt>.
  *
  * @param EntityManagerInterface $em           The EntityManager the new factory works for.
  * @param string                 $proxyDir     The directory to use for the proxy classes. It must exist.
  * @param string                 $proxyNs      The namespace to use for the proxy classes.
  * @param boolean|int            $autoGenerate The strategy for automatically generating proxy classes. Possible
  *                                             values are constants of Doctrine\Common\Proxy\AbstractProxyFactory.
  */
 public function __construct(EntityManagerInterface $em, $proxyDir, $proxyNs, $autoGenerate = AbstractProxyFactory::AUTOGENERATE_NEVER)
 {
     $proxyGenerator = new ProxyGenerator($proxyDir, $proxyNs);
     $proxyGenerator->setPlaceholder('baseProxyInterface', 'Doctrine\\ORM\\Proxy\\Proxy');
     parent::__construct($proxyGenerator, $em->getMetadataFactory(), $autoGenerate);
     $this->em = $em;
     $this->uow = $em->getUnitOfWork();
     $this->proxyNs = $proxyNs;
     $this->identifierFlattener = new IdentifierFlattener($this->uow, $em->getMetadataFactory());
 }
开发者ID:aschempp,项目名称:doctrine2,代码行数:20,代码来源:ProxyFactory.php

示例7: setUp

 public function setUp()
 {
     $client = self::createClient();
     $this->entityManager = $client->getContainer()->get('doctrine')->getManager();
     $metadata = $this->entityManager->getMetadataFactory()->getAllMetadata();
     if (!empty($metadata)) {
         $tool = new SchemaTool($this->entityManager);
         $tool->dropSchema($metadata);
         $tool->createSchema($metadata);
     }
 }
开发者ID:worldia,项目名称:textmaster-bundle,代码行数:11,代码来源:JobControllerTest.php

示例8: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     $this->connection = new MysqlPersistentConnection();
     $params = $this->connection->getConnectionParams();
     $config = Setup::createAnnotationMetadataConfiguration([__DIR__ . '/Entity'], true, null, null, false);
     $this->em = EntityManager::create($params, $config);
     // create tables in the database
     $metadata = $this->em->getMetadataFactory()->getAllMetadata();
     $schema_tool = new SchemaTool($this->em);
     $schema_tool->createSchema($metadata);
     $this->provider = new EntityMutationMetadataProvider(new AnnotationReader());
 }
开发者ID:hostnet,项目名称:entity-tracker-component,代码行数:15,代码来源:EntityMutationMetadataProviderTest.php

示例9: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     $isDevMode = true;
     $config = Setup::createAnnotationMetadataConfiguration(array(__DIR__ . "/../../../metadata/TestEntities"), $isDevMode, null, null, false);
     $connectionOptions = array('driver' => 'pdo_sqlite', 'memory' => true);
     // obtaining the entity manager
     self::$em = EntityManager::create($connectionOptions, $config);
     $schemaTool = new SchemaTool(self::$em);
     $cmf = self::$em->getMetadataFactory();
     $classes = $cmf->getAllMetadata();
     $schemaTool->dropDatabase();
     $schemaTool->createSchema($classes);
 }
开发者ID:mathielen,项目名称:import-engine,代码行数:13,代码来源:DoctrineTest.php

示例10: regenerateSchema

 protected function regenerateSchema()
 {
     $this->client = static::createClient();
     $container = $this->client->getContainer();
     $doctrine = $container->get('doctrine');
     $this->em = $doctrine->getManager();
     $metadata = $this->em->getMetadataFactory()->getAllMetadata();
     /**
      * Drops current schema and creates a brand new one
      */
     if (!empty($metadata)) {
         $tool = new SchemaTool($this->em);
         $tool->dropSchema($metadata);
         $tool->createSchema($metadata);
     }
 }
开发者ID:maxmode,项目名称:TTWorkshop,代码行数:16,代码来源:DBRegenerateTrait.php

示例11: initOrm

 protected function initOrm(EntityManagerInterface $entityManager)
 {
     $schemaTool = new SchemaTool($entityManager);
     $metadatas = $entityManager->getMetadataFactory()->getAllMetadata();
     $schemaTool->dropSchema($metadatas);
     $schemaTool->createSchema($metadatas);
 }
开发者ID:symfony-cmf,项目名称:content-type,代码行数:7,代码来源:OrmTestCase.php

示例12: processParameterValue

 /**
  * Processes an individual parameter value.
  *
  * @param mixed $value
  *
  * @return array|string
  *
  * @throws \Doctrine\ORM\ORMInvalidArgumentException
  */
 public function processParameterValue($value)
 {
     if (is_scalar($value)) {
         return $value;
     }
     if ($value instanceof Collection) {
         $value = $value->toArray();
     }
     if (is_array($value)) {
         foreach ($value as $key => $paramValue) {
             $paramValue = $this->processParameterValue($paramValue);
             $value[$key] = is_array($paramValue) ? reset($paramValue) : $paramValue;
         }
         return $value;
     }
     if (is_object($value) && $this->_em->getMetadataFactory()->hasMetadataFor(ClassUtils::getClass($value))) {
         $value = $this->_em->getUnitOfWork()->getSingleIdentifierValue($value);
         if ($value === null) {
             throw ORMInvalidArgumentException::invalidIdentifierBindingEntity();
         }
     }
     if ($value instanceof Mapping\ClassMetadata) {
         return $value->name;
     }
     return $value;
 }
开发者ID:AlexanderForks,项目名称:doctrine2,代码行数:35,代码来源:AbstractQuery.php

示例13: createSchemaForSupportedEntities

 /**
  * Creates the schema for the managed entities.
  *
  * @param EntityManagerInterface $entityManager
  */
 protected function createSchemaForSupportedEntities(EntityManagerInterface $entityManager)
 {
     $entityClasses = $this->getEntityClasses();
     $entityClasses[] = $this->getRepositoryObjectClass();
     $metadata = array_map(function ($className) use($entityManager) {
         return $entityManager->getMetadataFactory()->getMetadataFor($className);
     }, $entityClasses);
     $schemaTool = new SchemaTool($entityManager);
     $schemaTool->createSchema($metadata);
 }
开发者ID:a-mayer,项目名称:boekkooi-broadway,代码行数:15,代码来源:ObjectManagerScenarioTrait.php

示例14: toIdentifierArray

 /**
  * @param \Doctrine\ORM\Mapping\ClassMetadata $metadata   The entity metadata.
  * @param mixed                               $identifier The entity identifier.
  *
  * @return array
  */
 private function toIdentifierArray(ClassMetadata $metadata, $identifier)
 {
     if (is_object($identifier) && $this->em->getMetadataFactory()->hasMetadataFor(ClassUtils::getClass($identifier))) {
         $identifier = $this->uow->getSingleIdentifierValue($identifier);
         if ($identifier === null) {
             throw ORMInvalidArgumentException::invalidIdentifierBindingEntity();
         }
     }
     return array($metadata->identifier[0] => $identifier);
 }
开发者ID:Dren-x,项目名称:mobitnew,代码行数:16,代码来源:DefaultCache.php

示例15: fire

 public function fire()
 {
     $this->info('Starting proxy generation....');
     $metadata = $this->entityManager->getMetadataFactory()->getAllMetadata();
     if (empty($metadata)) {
         $this->error('No metadata found to generate any entities.');
         exit;
     }
     $directory = $this->laravel['config']['doctrine::doctrine.proxy.directory'];
     if (!$directory) {
         $this->error('The proxy directory has not been set.');
         exit;
     }
     $this->info('Processing entities:');
     foreach ($metadata as $item) {
         $this->line($item->name);
     }
     $this->entityManager->getProxyFactory()->generateProxyClasses($metadata, $directory);
     $this->info('Proxies have been created.');
 }
开发者ID:fmingorance,项目名称:laradoc,代码行数:20,代码来源:GenerateProxiesCommand.php


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