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


PHP EntityManager::getMetadataFactory方法代码示例

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


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

示例1: convert

 public function convert($cacheDir)
 {
     $fs = new Filesystem();
     $targetDir = $cacheDir . '/js_entities';
     $webDir = $this->kernel->getRootDir() . '/../web/js';
     $fs->mkdir($targetDir);
     $fs->mkdir($webDir);
     $namespaces = [];
     $metas = $this->entityManager->getMetadataFactory()->getAllMetadata();
     foreach ($metas as $metadata) {
         $meta = $this->convertMetadata($metadata);
         $directory = $targetDir . '/' . $meta->namespace;
         $fs->mkdir($directory);
         $meta->filename = $directory . '/' . $meta->functionName . '.js';
         $this->generator->generateEntity($meta);
         if (!isset($namespaces[$meta->namespace])) {
             $namespaces[$meta->namespace] = array();
         }
         $namespaces[$meta->namespace][] = $meta;
     }
     foreach ($namespaces as $namespace => $metas) {
         $targetFile = $targetDir . '/' . $namespace . '.js';
         $webFile = $webDir . '/' . $namespace . '.js';
         $this->generator->generateNamespace($namespace, $metas, $targetFile);
         $fs->copy($targetFile, $webFile);
     }
 }
开发者ID:CornyPhoenix,项目名称:JsEntitiesBundle,代码行数:27,代码来源:JsEntityConverter.php

示例2: boot

 /**
  * @throws \Doctrine\ORM\ORMException
  */
 public function boot()
 {
     $this->serializer = SerializerBuilder::create()->setDebug($this->devMode)->build();
     $this->entityFolder->create();
     AnnotationRegistry::registerAutoloadNamespace('JMS\\Serializer\\Annotation', __DIR__ . '/../../../../vendor/jms/serializer/src');
     $proxyDoctrineFolder = new Folder(sys_get_temp_dir() . '/doctrine');
     $config = Setup::createAnnotationMetadataConfiguration([$this->entityFolder->absolute()], $this->isDevMode(), $proxyDoctrineFolder->absolute());
     if ($this->cache !== null) {
         $config->setQueryCacheImpl($this->getCache());
         $config->setResultCacheImpl($this->getCache());
     }
     $this->entityManager = $this->createEntityManager($config);
     $debugStack = new DebugStack();
     $this->entityManager->getConnection()->getConfiguration()->setSQLLogger($debugStack);
     if ($this->getFileCreation()->getContent() == 1) {
         return;
     }
     if ($proxyDoctrineFolder->isFolder()) {
         $proxyDoctrineFolder->removeFiles();
     }
     $tool = new SchemaTool($this->entityManager);
     $metadatas = $this->entityManager->getMetadataFactory()->getAllMetadata();
     $proxyDoctrineFolder->create();
     $this->entityManager->getProxyFactory()->generateProxyClasses($metadatas, $proxyDoctrineFolder->absolute());
     if ($this->cloudFoundryBoot->isInCloudFoundry()) {
         $tool->updateSchema($metadatas);
     } else {
         $tool->createSchema($metadatas);
     }
     $this->getFileCreation()->setContent(1);
 }
开发者ID:cloudfoundry-community,项目名称:php-cf-service-broker,代码行数:34,代码来源:DoctrineBoot.php

示例3: purge

 /**
  * {@inheritdoc}
  */
 public function purge()
 {
     $classes = array();
     $metadatas = $this->em->getMetadataFactory()->getAllMetadata();
     foreach ($metadatas as $metadata) {
         if (!$metadata->isMappedSuperclass) {
             $classes[] = $metadata;
         }
     }
     $commitOrder = $this->getCommitOrder($this->em, $classes);
     // Drop association tables first
     $orderedTables = $this->getAssociationTables($commitOrder);
     // Get platform parameters
     $platform = $this->em->getConnection()->getDatabasePlatform();
     // Drop tables in reverse commit order
     for ($i = count($commitOrder) - 1; $i >= 0; --$i) {
         $class = $commitOrder[$i];
         if ($class->isInheritanceTypeSingleTable() && $class->name != $class->rootEntityName || $class->isMappedSuperclass) {
             continue;
         }
         $orderedTables[] = $class->getQuotedTableName($platform);
     }
     $orderedTables = array_diff($orderedTables, $this->excludedTables);
     foreach ($orderedTables as $tbl) {
         if ($this->purgeMode === self::PURGE_MODE_DELETE) {
             $this->em->getConnection()->executeUpdate("DELETE FROM " . $tbl);
         } else {
             $this->em->getConnection()->executeUpdate($platform->getTruncateTableSQL($tbl, true));
         }
     }
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:34,代码来源:SelectiveORMPurger.php

示例4: loadClassMetadata

 /**
  * @param LoadClassMetadataEventArgs $args
  */
 public function loadClassMetadata(LoadClassMetadataEventArgs $args)
 {
     $this->em = $args->getEntityManager();
     $this->meta = $args->getClassMetadata();
     if (!$this->em->getConnection()->getWrappedConnection() instanceof AbstractConnection) {
         return;
     }
     if ($this->meta->customPersisterClassName === null) {
         $this->meta->setCustomPersisterClass(EntityPersister::class);
     }
     $this->markIndex();
     foreach ($this->meta->fieldMappings as $property => &$mapping) {
         $this->remapIdentifier($property, $mapping);
         $this->remapVersion($property, $mapping);
         $this->markField($property, $mapping);
     }
     foreach ($this->meta->associationMappings as $property => &$mapping) {
         $this->remapAnyToOneAssociation($property, $mapping);
         $this->remapAnyToManyAssociation($property, $mapping);
         $this->remapManyToManyAssociation($property, $mapping);
     }
     if ($cache = $this->em->getMetadataFactory()->getCacheDriver()) {
         $cache->save($this->meta->name . '$CLASSMETADATA', $this->meta, null);
     }
 }
开发者ID:mihai-stancu,项目名称:orientdb-orm,代码行数:28,代码来源:OrientDBListener.php

示例5: getExtensionMetadata

 /**
  * Reads extension metadata
  * 
  * @param ClassMetadataInfo $meta
  * @return array - the metatada configuration
  */
 public function getExtensionMetadata(ClassMetadataInfo $meta)
 {
     if ($meta->isMappedSuperclass) {
         return;
         // ignore mappedSuperclasses for now
     }
     $config = array();
     // collect metadata from inherited classes
     foreach (array_reverse(class_parents($meta->name)) as $parentClass) {
         // read only inherited mapped classes
         if ($this->_em->getMetadataFactory()->hasMetadataFor($parentClass)) {
             $this->_driver->readExtendedMetadata($this->_em->getClassMetadata($parentClass), $config);
         }
     }
     $this->_driver->readExtendedMetadata($meta, $config);
     $this->_driver->validateFullMetadata($meta, $config);
     if ($config) {
         // cache the metadata
         $cacheId = self::getCacheId($meta->name, $this->_extensionNamespace);
         if ($cacheDriver = $this->_em->getMetadataFactory()->getCacheDriver()) {
             $cacheDriver->save($cacheId, $config, null);
         }
     }
     return $config;
 }
开发者ID:jgat2012,项目名称:hp_oms,代码行数:31,代码来源:ExtensionMetadataFactory.php

示例6: getMetadata

 public static function getMetadata()
 {
     /** @var EntityManagerInterface $em */
     static::$em = static::$kernel->getContainer()->get('doctrine')->getManager();
     $metadata = static::$em->getMetadataFactory()->getAllMetadata();
     return $metadata;
 }
开发者ID:scaytrase,项目名称:symfony-test-utils,代码行数:7,代码来源:FixtureTestCase.php

示例7: resetDatabase

 public function resetDatabase()
 {
     $metadatas = $this->em->getMetadataFactory()->getAllMetadata();
     $tool = new \Doctrine\ORM\Tools\SchemaTool($this->em);
     $tool->dropDatabase();
     $tool->createSchema($metadatas);
 }
开发者ID:dstansby,项目名称:camdram,代码行数:7,代码来源:DatabaseTools.php

示例8: __construct

 public function __construct(EntityManager $em, $currencyClassName)
 {
     $this->em = $em;
     $this->currencyClassName = $currencyClassName;
     if (!$currencyClassName || !$this->em->getMetadataFactory()->hasMetadataFor($currencyClassName) && !$this->em->getClassMetadata($currencyClassName)) {
         throw new \Exception("Class for currency \"{$currencyClassName}\" not found");
     }
 }
开发者ID:remedge,项目名称:redcode-currency-rate-bundle,代码行数:8,代码来源:CurrencyManager.php

示例9: init

 protected function init()
 {
     $this->em = $this->app['em'];
     $this->connection = $this->em->getConnection();
     $this->schemaManager = $this->em->getConnection()->getSchemaManager();
     $this->schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->em);
     $this->validator = new \Doctrine\ORM\Tools\SchemaValidator($this->em);
     $this->metadatas = $this->em->getMetadataFactory()->getAllMetadata();
 }
开发者ID:elfet,项目名称:silicone,代码行数:9,代码来源:Command.php

示例10: generateSchema

 /**
  * @return null
  */
 protected function generateSchema()
 {
     $metadatas = $this->em->getMetadataFactory()->getAllMetadata();
     if (!empty($metadatas)) {
         $tool = new \Doctrine\ORM\Tools\SchemaTool($this->em);
         $tool->dropSchema($metadatas);
         $tool->createSchema($metadatas);
     }
 }
开发者ID:victorhaggqvist,项目名称:SettingsBundle,代码行数:12,代码来源:AbstractTest.php

示例11: createSchema

 private function createSchema()
 {
     $this->getProvider()->deleteDatabase($this->getDatabaseName());
     $schemaTool = new SchemaTool($this->entityManager);
     $schemaTool->createSchema($this->entityManager->getMetadataFactory()->getAllMetadata());
     $this->loadFixtures();
     $this->getProvider()->backupDatabase($this->getDatabaseName());
     self::$schemaExists = true;
 }
开发者ID:outeredge,项目名称:edge-zf2,代码行数:9,代码来源:AbstractDoctrineServiceTestCase.php

示例12: getEntityClassesFromEntityManager

 /**
  * @return array
  */
 protected function getEntityClassesFromEntityManager()
 {
     $entityClasses = [];
     $metaData = $this->entityManager->getMetadataFactory()->getAllMetadata();
     foreach ($metaData as $classMetaData) {
         $entityClasses[] = $classMetaData->getName();
     }
     return $entityClasses;
 }
开发者ID:pmill,项目名称:doctrine-rest-api,代码行数:12,代码来源:Doctrine.php

示例13: getManagedEntities

 /**
  * @return ChoiceQuestion
  */
 protected function getManagedEntities()
 {
     $metadata = $this->em->getMetadataFactory()->getAllMetadata();
     $entities = [];
     /** @var ClassMetadata $meta */
     foreach ($metadata as $index => $meta) {
         $entities[$index] = $meta->getReflectionClass()->getName();
     }
     return $entities;
 }
开发者ID:bitecodes,项目名称:factrine-bundle,代码行数:13,代码来源:FactrineSeedEntityCommand.php

示例14: setUp

 public function setUp()
 {
     $dbParams = array('dbname' => 'metamodel_test', 'memory' => 'true', 'driver' => 'pdo_sqlite');
     $config = Setup::createAnnotationMetadataConfiguration(array(__DIR__ . "/Fixture"), true);
     $this->em = EntityManager::create($dbParams, $config);
     $tool = new SchemaTool($this->em);
     $tool->createSchema($this->em->getMetadataFactory()->getAllMetadata());
     $this->metaModel = new MetaModel();
     $this->metaModel->addObjectManager(new EntityManagerBridge($this->em));
 }
开发者ID:mnapoli,项目名称:metamodel,代码行数:10,代码来源:QueryTest.php

示例15: setUp

 protected function setUp()
 {
     parent::setUp();
     if (!isset(static::$_sharedConn)) {
         static::$_sharedConn = $this->_getDefaultConnection();
     }
     $this->_em = $this->_getTestEntityManager(static::$_sharedConn);
     $this->_schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->_em);
     $this->_schemaTool->createSchema($this->_em->getMetadataFactory()->getAllMetadata());
 }
开发者ID:jdrich,项目名称:drest,代码行数:10,代码来源:DrestFunctionalTestCase.php


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