/**
  * @param ClassMetadata $classMetadata
  * @param string        $associationName
  *
  * @return AssociationMetadata
  */
 public function createAssociationMetadata(ClassMetadata $classMetadata, $associationName)
 {
     $targetClass = $classMetadata->getAssociationTargetClass($associationName);
     $associationMetadata = new AssociationMetadata();
     $associationMetadata->setName($associationName);
     $associationMetadata->setTargetClassName($targetClass);
     $associationMetadata->setIsCollection($classMetadata->isCollectionValuedAssociation($associationName));
     $targetMetadata = $this->doctrineHelper->getEntityMetadataForClass($targetClass);
     $targetIdFields = $targetMetadata->getIdentifierFieldNames();
     if (count($targetIdFields) === 1) {
         $associationMetadata->setDataType($targetMetadata->getTypeOfField(reset($targetIdFields)));
     } else {
         $associationMetadata->setDataType(DataType::STRING);
     }
     return $associationMetadata;
 }
 /**
  * @param ClassMetadata $classMetadata
  * @param string        $associationName
  *
  * @return AssociationMetadata
  */
 public function createAssociationMetadata(ClassMetadata $classMetadata, $associationName)
 {
     $targetClass = $classMetadata->getAssociationTargetClass($associationName);
     $associationMetadata = new AssociationMetadata();
     $associationMetadata->setName($associationName);
     $associationMetadata->setTargetClassName($targetClass);
     $associationMetadata->setIsCollection($classMetadata->isCollectionValuedAssociation($associationName));
     $targetMetadata = $this->doctrineHelper->getEntityMetadataForClass($targetClass);
     $targetIdFields = $targetMetadata->getIdentifierFieldNames();
     if (count($targetIdFields) === 1) {
         $associationMetadata->setDataType($targetMetadata->getTypeOfField(reset($targetIdFields)));
     } else {
         $associationMetadata->setDataType(DataType::STRING);
     }
     if ($targetMetadata->inheritanceType !== ClassMetadata::INHERITANCE_TYPE_NONE) {
         $associationMetadata->setAcceptableTargetClassNames($targetMetadata->subClasses);
     } else {
         $associationMetadata->addAcceptableTargetClassName($targetClass);
     }
     return $associationMetadata;
 }