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.
        Hide
        Oleg Namaka added a comment -

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

        Show
        Oleg Namaka added a comment - We need this feature too. Why is this ticket in a limbo? Someone please add a comment whether this will be fixed.
        Hide
        Marco Pivetta added a comment -

        Oleg Namaka you can open a pull request with a test and suggested improvement for this at https://github.com/doctrine/doctrine2

        Show
        Marco Pivetta added a comment - Oleg Namaka you can open a pull request with a test and suggested improvement for this at https://github.com/doctrine/doctrine2

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-2042, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

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

            Dates

            • Created:
              Updated: