當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ClassMetadataInfo::getAssociationMapping方法代碼示例

本文整理匯總了PHP中Doctrine\ORM\Mapping\ClassMetadataInfo::getAssociationMapping方法的典型用法代碼示例。如果您正苦於以下問題:PHP ClassMetadataInfo::getAssociationMapping方法的具體用法?PHP ClassMetadataInfo::getAssociationMapping怎麽用?PHP ClassMetadataInfo::getAssociationMapping使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\ORM\Mapping\ClassMetadataInfo的用法示例。


在下文中一共展示了ClassMetadataInfo::getAssociationMapping方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getORMTransformerInfo

 /**
  * @param ColumnInfoInterface  $columnInfo
  * @param ORMClassMetadataInfo $metadata
  *
  * @return array
  */
 private function getORMTransformerInfo(ColumnInfoInterface $columnInfo, ORMClassMetadataInfo $metadata)
 {
     if (!$metadata->hasAssociation($columnInfo->getPropertyPath())) {
         return;
     }
     $mapping = $metadata->getAssociationMapping($columnInfo->getPropertyPath());
     if (!$this->doctrine->getRepository($mapping['targetEntity']) instanceof ReferableEntityRepositoryInterface) {
         return;
     }
     return array($this->transformer, array('class' => $mapping['targetEntity'], 'multiple' => ORMClassMetadataInfo::MANY_TO_MANY === $mapping['type']));
 }
開發者ID:javiersantos,項目名稱:pim-community-dev,代碼行數:17,代碼來源:RelationGuesser.php

示例2: getAssocicationHandler

 /**
  * @param $association
  * @param ClassMetadataInfo $meta
  * @return ManyToMany|ManyToOne|OneToMany|OneToOne
  * @throws \Doctrine\ORM\Mapping\MappingException
  */
 private function getAssocicationHandler($association, ClassMetadataInfo $meta)
 {
     $mapping = $meta->getAssociationMapping($association);
     switch ($mapping['type']) {
         case ClassMetadataInfo::ONE_TO_ONE:
             $assoc = new OneToOne($this->accessor, $this);
             break;
         case ClassMetadataInfo::MANY_TO_ONE:
             $assoc = new ManyToOne($this->accessor, $this);
             break;
         case ClassMetadataInfo::ONE_TO_MANY:
             $assoc = new OneToMany($this->accessor, $this);
             break;
         case ClassMetadataInfo::MANY_TO_MANY:
             $assoc = new ManyToMany($this->accessor, $this);
             break;
     }
     return $assoc;
 }
開發者ID:bitecodes,項目名稱:factrine-bundle,代碼行數:25,代碼來源:EntityBuilder.php

示例3: findTranslationsCollection

 protected function findTranslationsCollection(Reader $reader, ClassMetadataInfo $classMetadata)
 {
     foreach ($classMetadata->getReflectionClass()->getProperties() as $property) {
         $annotation = $reader->getPropertyAnnotation($property, 'Webfactory\\Bundle\\PolyglotBundle\\Annotation\\TranslationCollection');
         if ($annotation !== null) {
             $property->setAccessible(true);
             $this->translationsCollectionProperty = $property;
             $am = $classMetadata->getAssociationMapping($property->getName());
             $this->parseTranslationsEntity($reader, $am['targetEntity']);
             $translationMappingProperty = $this->translationClass->getProperty($am['mappedBy']);
             $translationMappingProperty->setAccessible(true);
             $this->translationMappingProperty = $translationMappingProperty;
             break;
         }
     }
 }
開發者ID:MalteWunsch,項目名稱:polyglot-bundle,代碼行數:16,代碼來源:TranslationMetadata.php

示例4: isUniDirectional

 private function isUniDirectional()
 {
     $mapping = $this->meta->getAssociationMapping($this->association);
     return null === $mapping['mappedBy'] && null === $mapping['inversedBy'];
 }
開發者ID:bitecodes,項目名稱:factrine-bundle,代碼行數:5,代碼來源:AbstractAssociation.php

示例5: mapValue

 /**
  * @param ClassMetadataInfo $meta
  * @param string            $field
  * @param mixed             $value
  */
 protected function mapValue(ClassMetadataInfo $meta, $field, &$value)
 {
     if ($meta->isSingleValuedAssociation($field)) {
         $mapping = $meta->getAssociationMapping($field);
         $value = $value ? $this->em->getReference($mapping['targetEntity'], $value) : null;
         return;
     }
     $type = Type::getType($meta->fieldMappings[$field]['type']);
     $value = $type->convertToPHPValue($value, $this->em->getConnection()->getDatabasePlatform());
 }
開發者ID:opifer,項目名稱:revisions,代碼行數:15,代碼來源:RevisionManager.php

示例6: guessAssociation

 /**
  * @param ClassMetadataInfo $metadata
  * @param Field             $field
  * @param SchemaContainer   $schemaContainer
  * @return TypeGuess
  * @throws MappingException
  */
 private function guessAssociation(ClassMetadataInfo $metadata, Field $field, SchemaContainer $schemaContainer)
 {
     $property = $field->getProperty() ?: $field->getName();
     $multiple = $metadata->isCollectionValuedAssociation($property);
     $mapping = $metadata->getAssociationMapping($property);
     foreach ($schemaContainer->getTypes() as $type) {
         $containerContext = new ContainerContext($type, $schemaContainer);
         if (!$this->isFieldContainerSupported($containerContext)) {
             continue;
         }
         if ($type->getModel() === $mapping['targetEntity']) {
             $typeName = $type->getName();
             if ($multiple) {
                 $typeName = sprintf('[%s]', $typeName);
             }
             return new TypeGuess($typeName, Guess::HIGH_CONFIDENCE);
         }
     }
 }
開發者ID:4rthem,項目名稱:graphql-mapper,代碼行數:26,代碼來源:DoctrineGuesser.php


注:本文中的Doctrine\ORM\Mapping\ClassMetadataInfo::getAssociationMapping方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。