當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。