/** * @param FamilyInterface $parentFamily * @param AttributeInterface $attribute * @return string */ protected function getTargetClass(FamilyInterface $parentFamily, AttributeInterface $attribute) { /** @var \Doctrine\ORM\Mapping\ClassMetadata $classMetadata */ $classMetadata = $this->manager->getClassMetadata($parentFamily->getValueClass()); try { $mapping = $classMetadata->getAssociationMapping($attribute->getType()->getDatabaseType()); } catch (MappingException $e) { return null; } if (empty($mapping['targetEntity'])) { return null; } $type = $mapping['targetEntity']; if ($attribute->isMultiple()) { $type .= '[]'; } return '\\' . $type; }
/** * @param FamilyInterface $parent */ protected function copyFromFamily(FamilyInterface $parent) { foreach ($parent->getAttributes() as $attribute) { $this->addAttribute($attribute); } $this->attributeAsLabel = $parent->getAttributeAsLabel(); $this->attributeAsIdentifier = $parent->getAttributeAsIdentifier(); $this->valueClass = $parent->getValueClass(); $this->dataClass = $parent->getDataClass(); }