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

        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

          People

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

            Dates

            • Created:
              Updated: