当前位置: 首页>>代码示例>>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;未经允许,请勿转载。