DDC-2042: Metadata association overriding : allow to override 'targetEntity' #2721

Open
doctrinebot opened this Issue Sep 26, 2012 · 2 comments

2 participants

@doctrinebot

Jira issue originally created by user cro:

While associating object to an descriminated table I wasn't enable to fix the entityTarget (only one can be set in entity annotation).

It could be resolve by adding the possibility to override 'targetEntity' value in Doctrine\ORM\Mapping\ClassMetadataInfo::ClassMetadataInfo().

Such as :
{quote}
if (isset($overrideMapping['targetEntity'])) {
$mapping['targetEntity'] = $overrideMapping['targetEntity'];
}
{quote}

That would need to add a control on the new targetEntity in Doctrine\ORM\Mapping\ClassMetadataInfo::_validateAndCompleteAssociationMapping().

Such as :
{quote}
if ( ! ClassLoader::classExists($mapping['targetEntity']) ) {
throw MappingException::invalidTargetEntityClass($mapping['targetEntity'], $this->name, $mapping['fieldName']);
}
{quote}

cro.

@doctrinebot

Comment created by deatheriam:

We need this feature too. Why is this ticket in a limbo? Someone please add a comment whether this will be fixed.

@doctrinebot

Comment created by @ocramius:

[~deatheriam] you can open a pull request with a test and suggested improvement for this at https://github.com/doctrine/doctrine2

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment