Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2042

Metadata association overriding : allow to override 'targetEntity'

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      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 :

      if (isset($overrideMapping['targetEntity'])) {
      $mapping['targetEntity'] = $overrideMapping['targetEntity'];
      }

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

      Such as :

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

      cro.

        Activity

        Charles Rouillon created issue -
        Charles Rouillon made changes -
        Field Original Value New Value
        Description 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.
        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.
        Charles Rouillon made changes -
        Description 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.
        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.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Charles Rouillon
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated: