diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php index d845e6f59..0c3a339eb 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php @@ -1849,6 +1849,21 @@ class ClassMetadataInfo implements ClassMetadata } } + /** + * Refine an association targetEntity class pointer to be consumed through loadMetadata event. + * + * @param string $assoc + * @param string $class + */ + public function setAssociationTargetClass($assocName, $class) + { + if ( ! isset($this->associationMappings[$assocName])) { + throw new \InvalidArgumentException("Association name expected, '" . $assocName ."' is not an association."); + } + + $this->associationMappings[$assocName]['targetEntity'] = $class; + } + /** * Sets whether this class is to be versioned for optimistic locking. *