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


PHP DisconnectedClassMetadataFactory::getMetadataFor方法代码示例

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


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

示例1: testTest

 public function testTest()
 {
     if (!class_exists('Symfony\\Component\\Yaml\\Yaml', true)) {
         $this->markTestSkipped('Please install Symfony YAML Component into the include path of your PHP installation.');
     }
     $cme = new ClassMetadataExporter();
     $converter = new ConvertDoctrine1Schema(__DIR__ . '/doctrine1schema');
     $exporter = $cme->getExporter('yml', __DIR__ . '/convert');
     $exporter->setOverwriteExistingFiles(true);
     $exporter->setMetadata($converter->getMetadata());
     $exporter->export();
     $this->assertTrue(file_exists(__DIR__ . '/convert/User.dcm.yml'));
     $this->assertTrue(file_exists(__DIR__ . '/convert/Profile.dcm.yml'));
     $metadataDriver = new \Doctrine\ORM\Mapping\Driver\YamlDriver(__DIR__ . '/convert');
     $em = $this->_createEntityManager($metadataDriver);
     $cmf = new DisconnectedClassMetadataFactory();
     $cmf->setEntityManager($em);
     $metadata = $cmf->getAllMetadata();
     $profileClass = $cmf->getMetadataFor('Profile');
     $userClass = $cmf->getMetadataFor('User');
     $this->assertEquals(2, count($metadata));
     $this->assertEquals('Profile', $profileClass->name);
     $this->assertEquals('User', $userClass->name);
     $this->assertEquals(4, count($profileClass->fieldMappings));
     $this->assertEquals(5, count($userClass->fieldMappings));
     $this->assertEquals('text', $userClass->fieldMappings['clob']['type']);
     $this->assertEquals('test_alias', $userClass->fieldMappings['theAlias']['columnName']);
     $this->assertEquals('theAlias', $userClass->fieldMappings['theAlias']['fieldName']);
     $this->assertEquals('Profile', $profileClass->associationMappings['User']['sourceEntity']);
     $this->assertEquals('User', $profileClass->associationMappings['User']['targetEntity']);
     $this->assertEquals('username', $userClass->table['uniqueConstraints']['username']['columns'][0]);
 }
开发者ID:Herriniaina,项目名称:iVarotra,代码行数:32,代码来源:ConvertDoctrine1SchemaTest.php

示例2: getAllMetadata

 protected function getAllMetadata(array $entity)
 {
     $metadata = array();
     $cmf = new DisconnectedClassMetadataFactory();
     $cmf->setEntityManager($this->_em);
     foreach ($entity as $e) {
         $metadata[] = $cmf->getMetadataFor($e);
     }
     return $metadata;
 }
开发者ID:controleonline,项目名称:core,代码行数:10,代码来源:InstallModel.php

示例3: getMetadataForClass

 /**
  * @param string $entity
  *
  * @return ClassMetadataCollection
  */
 private function getMetadataForClass($entity)
 {
     foreach ($this->registry->getManagers() as $em) {
         $cmf = new DisconnectedClassMetadataFactory();
         $cmf->setEntityManager($em);
         if (!$cmf->isTransient($entity)) {
             return new ClassMetadataCollection(array($cmf->getMetadataFor($entity)));
         }
     }
     return new ClassMetadataCollection(array());
 }
开发者ID:RuntyCybin,项目名称:csymfony,代码行数:16,代码来源:DisconnectedMetadataFactory.php

示例4: entityManager

 /**
  * Entidades::entityManager()
  * 
  * Prepara el proceso de la creacion de las entidades
  * @param object $configuracion
  * @return object
  */
 private function entityManager($configuracion = false)
 {
     $entidad = EntityManager::create($this->confg, $configuracion);
     $entidad->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('set', 'string');
     $entidad->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
     // fetch metadata
     $driver = new DatabaseDriver($entidad->getConnection()->getSchemaManager());
     $driver->setNamespace('Entidades\\' . $this->conexion . '\\');
     //Agrega el namespace Entidad\Nombre de la tabla
     $entidad->getConfiguration()->setMetadataDriverImpl($driver);
     $cmf = new DisconnectedClassMetadataFactory();
     $cmf->setEntityManager($entidad);
     // we must set the EntityManager
     $classes = $driver->getAllClassNames();
     $metadata = array();
     foreach ($classes as $class) {
         //any unsupported table/schema could be handled here to exclude some classes
         if (true) {
             $metadata[] = $cmf->getMetadataFor($class);
         }
     }
     $this->generador($metadata);
 }
开发者ID:NeuralFramework,项目名称:NeuralPHPv4,代码行数:30,代码来源:Entidades.php


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