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


PHP ClassMetadataInfo::getName方法代码示例

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


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

示例1: generate

 /**
  * @param ClassMetadataInfo $metadata
  * @param string $outputDir
  * @param Closure $collectionNameBuilder
  */
 public function generate(ClassMetadataInfo $metadata, $outputDir, Closure $collectionNameBuilder)
 {
     $tpl = file_get_contents(CodeGeneratorHelper::absPath(EntityCollectionTemplate::class, RootPath::path()));
     $tplNs = CodeGeneratorHelper::ns(EntityCollectionTemplate::class);
     $tplSimpleName = CodeGeneratorHelper::simpleName(EntityCollectionTemplate::class);
     $entityFqcn = CodeGeneratorHelper::simpleName(EntityFqcn::class);
     $collectionClassName = $collectionNameBuilder($metadata->getName());
     $code = CodeGeneratorHelper::render($tpl, array($tplNs => CodeGeneratorHelper::ns($collectionClassName), $tplSimpleName => CodeGeneratorHelper::simpleName($collectionClassName), $entityFqcn => CodeGeneratorHelper::fqn($metadata->getName())));
     CodeGeneratorHelper::save($collectionClassName, $code, $outputDir);
 }
开发者ID:zorji,项目名称:doctrine-query-collection,代码行数:15,代码来源:EntityCollectionCodeGenerator.php

示例2: generateCodeBody

 protected function generateCodeBody(ClassMetadataInfo $metadata)
 {
     $methods = array();
     $methods[] = $this->generateFindBy($metadata->getName());
     foreach ($metadata->fieldMappings as $fieldMapping) {
         $methods[] = $this->generateFieldFindBy($metadata->getName(), $fieldMapping['type'], $fieldMapping['fieldName']);
     }
     foreach ($metadata->embeddedClasses as $fieldName => $embeddedClass) {
         $methods[] = $this->generateFieldFindBy($metadata->getName(), $embeddedClass['class'], $fieldName);
     }
     foreach ($metadata->associationMappings as $associationMapping) {
         $methods[] = $this->generateFieldFindBy($metadata->getName(), $associationMapping['targetEntity'], $associationMapping['fieldName']);
     }
     return implode("\n", $methods);
 }
开发者ID:zorji,项目名称:doctrine-query-collection,代码行数:15,代码来源:IdeFriendlyEntityRepositoryGenerator.php

示例3: traverse

 /**
  * {@inheritdoc}
  */
 public function traverse(ClassMetadataInfo $metadata)
 {
     $class = $metadata->getName();
     if (true === $this->collection->has($class)) {
         foreach ($this->collection->get($class) as $enhancer) {
             $enhancer->visitClassMetadata($metadata);
         }
     }
 }
开发者ID:WellCommerce,项目名称:DoctrineBundle,代码行数:12,代码来源:ClassMetadataEnhancerTraverser.php

示例4: testLoadMetadataForClass

 public function testLoadMetadataForClass()
 {
     $metadata = new ClassMetadataInfo('Giftcards\\Encryption\\Tests\\Doctrine\\MockEntityWithEncryptedProperties');
     $metadata->reflClass = new \ReflectionClass($metadata->getName());
     $this->driver->loadMetadataForClass($metadata->getName(), $metadata);
     $this->assertTrue($metadata->hasEncryptedProperties);
     $this->assertEquals(array('encryptedProperty' => array('profile' => null)), $metadata->encryptedProperties);
     $metadata = new ClassMetadataInfo('Giftcards\\Encryption\\Tests\\Doctrine\\MockEntityWithEncryptedPropertiesAndProfileSet');
     $metadata->reflClass = new \ReflectionClass($metadata->getName());
     $this->driver->loadMetadataForClass($metadata->getName(), $metadata);
     $this->assertTrue($metadata->hasEncryptedProperties);
     $this->assertEquals(array('encryptedProperty' => array('profile' => 'foo')), $metadata->encryptedProperties);
 }
开发者ID:SaveYa,项目名称:Encryption,代码行数:13,代码来源:AnnotationDriverTest.php

示例5: hasAssociationConfigs

 /**
  * {@inheritdoc}
  */
 protected function hasAssociationConfigs(ClassMetadataInfo $metadata, $associationName)
 {
     if ($this->isExtendField($metadata->getName(), $associationName)) {
         return false;
     }
     // check for default field of oneToMany or manyToMany relation
     if (strpos($associationName, ExtendConfigDumper::DEFAULT_PREFIX) === 0) {
         $guessedName = substr($associationName, strlen(ExtendConfigDumper::DEFAULT_PREFIX));
         if (!empty($guessedName) && $this->isExtendField($metadata->getName(), $guessedName)) {
             return false;
         }
     }
     // check for inverse side field of oneToMany relation
     $targetClass = $metadata->getAssociationTargetClass($associationName);
     $prefix = strtolower(ExtendHelper::getShortClassName($targetClass)) . '_';
     if (strpos($associationName, $prefix) === 0) {
         $guessedName = substr($associationName, strlen($prefix));
         if (!empty($guessedName) && $this->isExtendField($targetClass, $guessedName)) {
             return false;
         }
     }
     return parent::hasAssociationConfigs($metadata, $associationName);
 }
开发者ID:xamin123,项目名称:platform,代码行数:26,代码来源:ExtendConfigLoader.php

示例6:

 function it_configures_the_mappings_of_a_model_that_overrides_an_original_model($configuration, ClassMetadataInfo $metadataInfo, MappingDriver $mappingDriver)
 {
     $originalQux1 = __NAMESPACE__ . '\\OriginalQux1';
     $originalQux2 = __NAMESPACE__ . '\\OriginalQux2';
     $overrideQux1 = __NAMESPACE__ . '\\OverrideQux1';
     $overrideQux2 = __NAMESPACE__ . '\\OverrideQux2';
     $mappingDriver->getAllClassNames()->willReturn([$originalQux1]);
     $configuration->getMetadataDriverImpl()->willReturn($mappingDriver);
     $configuration->getNamingStrategy()->willReturn(null);
     $metadataInfo->getName()->willReturn($overrideQux1);
     $mappingDriver->loadMetadataForClass($originalQux1, Argument::any())->shouldBeCalled();
     $overrides = [['original' => $originalQux1, 'override' => $overrideQux1], ['original' => $originalQux2, 'override' => $overrideQux2]];
     $this->configure($metadataInfo, $overrides, $configuration);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:14,代码来源:MappingsOverrideConfiguratorSpec.php

示例7: setAssociationMappings

 /**
  * Set the association mappings of a metadata.
  *
  * @param ClassMetadataInfo $metadata
  * @param Configuration     $configuration
  */
 protected function setAssociationMappings(ClassMetadataInfo $metadata, Configuration $configuration)
 {
     $supportedClasses = $configuration->getMetadataDriverImpl()->getAllClassNames();
     foreach (class_parents($metadata->getName()) as $parent) {
         if (in_array($parent, $supportedClasses)) {
             $parentMetadata = new OrmClassMetadata($parent, $configuration->getNamingStrategy());
             $configuration->getMetadataDriverImpl()->loadMetadataForClass($parent, $parentMetadata);
             foreach ($parentMetadata->getAssociationMappings() as $key => $value) {
                 if ($this->hasRelation($value['type'])) {
                     $metadata->associationMappings[$key] = $value;
                 }
             }
         }
     }
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:21,代码来源:MappingsOverrideConfigurator.php

示例8: setAssociationMappings

 /**
  * @param ClassMetadataInfo $metadata
  * @param $configuration
  */
 private function setAssociationMappings(ClassMetadataInfo $metadata, $configuration)
 {
     foreach (class_parents($metadata->getName()) as $parent) {
         $parentMetadata = new ClassMetadata($parent, $configuration->getNamingStrategy());
         if (in_array($parent, $configuration->getMetadataDriverImpl()->getAllClassNames())) {
             $configuration->getMetadataDriverImpl()->loadMetadataForClass($parent, $parentMetadata);
             if ($parentMetadata->isMappedSuperclass) {
                 foreach ($parentMetadata->getAssociationMappings() as $key => $value) {
                     if ($this->hasRelation($value['type'])) {
                         $metadata->associationMappings[$key] = $value;
                     }
                 }
             }
         }
     }
 }
开发者ID:dzoke,项目名称:Cms,代码行数:20,代码来源:LoadORMMetadataSubscriber.php

示例9: setAssociationMappings

 /**
  * @param ClassMetadataInfo $metadata
  * @param $configuration
  */
 private function setAssociationMappings(ClassMetadataInfo $metadata, $configuration)
 {
     foreach (class_parents($metadata->getName()) as $parent) {
         if (false === in_array($parent, $configuration->getMetadataDriverImpl()->getAllClassNames())) {
             continue;
         }
         $parentMetadata = new ClassMetadata($parent, $configuration->getNamingStrategy());
         // Wakeup Reflection
         $parentMetadata->wakeupReflection($this->getReflectionService());
         // Load Metadata
         $configuration->getMetadataDriverImpl()->loadMetadataForClass($parent, $parentMetadata);
         if (false === $this->isResource($parentMetadata)) {
             continue;
         }
         if ($parentMetadata->isMappedSuperclass) {
             foreach ($parentMetadata->getAssociationMappings() as $key => $value) {
                 if ($this->hasRelation($value['type'])) {
                     $metadata->associationMappings[$key] = $value;
                 }
             }
         }
     }
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:27,代码来源:ORMMappedSuperClassSubscriber.php

示例10: setAssociationMappings

 /**
  * @param ClassMetadataInfo $metadata
  * @param Configuration     $configuration
  */
 private function setAssociationMappings(ClassMetadataInfo $metadata, Configuration $configuration)
 {
     if (!class_exists($metadata->getName())) {
         return;
     }
     foreach (class_parents($metadata->getName()) as $parent) {
         $parentMetadata = new ClassMetadata($parent, $configuration->getNamingStrategy());
         if (!in_array($parent, $this->getAllClassNames($configuration))) {
             continue;
         }
         $configuration->getMetadataDriverImpl()->loadMetadataForClass($parent, $parentMetadata);
         if (!$parentMetadata->isMappedSuperclass) {
             continue;
         }
         // map relations
         foreach ($parentMetadata->getAssociationMappings() as $key => $value) {
             if ($this->hasRelation($value['type'])) {
                 $value['sourceEntity'] = $metadata->getName();
                 $metadata->associationMappings[$key] = $value;
             }
         }
     }
 }
开发者ID:sulu,项目名称:sulu,代码行数:27,代码来源:MetadataSubscriber.php

示例11: getPrimaryKeyName

 public static function getPrimaryKeyName(ClassMetadataInfo $metadata)
 {
     $fieldMappings = $metadata->fieldMappings;
     foreach ($fieldMappings as $mapping) {
         if (array_key_exists('id', $mapping) && $mapping['id']) {
             return $mapping['fieldName'];
         }
     }
     throw new \Exception(sprintf('Primary key not defined for %s', $metadata->getName()));
 }
开发者ID:zorji,项目名称:doctrine-query-collection,代码行数:10,代码来源:CodeGeneratorHelper.php

示例12: hasEntityConfigs

 /**
  * @param ClassMetadataInfo $metadata
  * @return bool
  */
 protected function hasEntityConfigs(ClassMetadataInfo $metadata)
 {
     $classMetadata = $this->configManager->getEntityMetadata($metadata->getName());
     return $classMetadata && $classMetadata->configurable;
 }
开发者ID:xamin123,项目名称:platform,代码行数:9,代码来源:ConfigLoader.php

示例13: getBaseQueryCollectionClassName

 public function getBaseQueryCollectionClassName(ClassMetadataInfo $metadata)
 {
     return $this->getQueryCollectionClassNameByEntityClass($metadata->getName());
 }
开发者ID:zorji,项目名称:doctrine-query-collection,代码行数:4,代码来源:QueryCollectionCodeGeneratorHelper.php

示例14: setClass

 /**
  * Sets the type of the entity this manager is responsible for
  *
  * @param string $entityClass The FQCN of an entity
  */
 public function setClass($entityClass)
 {
     $this->metadata = $this->om->getClassMetadata($entityClass);
     $this->class = $this->metadata->getName();
 }
开发者ID:northdakota,项目名称:platform,代码行数:10,代码来源:ApiEntityManager.php

示例15: dumpFile

 /**
  * @param ClassMetadataInfo $classMetadataInfo
  * @param string            $dumpDirectory
  *
  * return void
  */
 private function dumpFile(ClassMetadataInfo $classMetadataInfo, $dumpDirectory)
 {
     $this->output->writeln("[" . date('c') . "] dumping {$classMetadataInfo->getName()} ...");
     $this->dumper->setClassMetadataInfo($classMetadataInfo);
     $file = $this->dumper->dumpToYaml($dumpDirectory);
     $this->output->writeln("[" . date('c') . "] successfully dumped in file  {$file}");
     $this->output->writeln(PHP_EOL);
 }
开发者ID:stevepop,项目名称:testing-bundle,代码行数:14,代码来源:FixturesExportCommand.php


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