Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-687

Add New Entity Attribute "idGetter" to allow accessing the ID without triggering lazy-load

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-BETA2
    • Fix Version/s: 2.2
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      Often people present us with the use-case that they want to access the ID of a proxy without loading it.

      This has lead to several ugly solutions like mapping the ID to an object and as a foreign key field. There currently exists a simple solution for this:

      $id = $em->getUnitOfWork()->getEntityIdentifier($entity->getRelatedProxy());
      

      However we could add a new property here called "idGetter" that would take the name of a method.

      During Proxy Generation then this method is created with magic functionality that:

      1. In case of Single Primary Key returns the single value
      2. In case of Composite Primary Key returns an array of the values in their UoW internal order
      3. Throw an Exception if the method does not exist on the original object

        Activity

        Benjamin Eberlei created issue -
        Benjamin Eberlei made changes -
        Field Original Value New Value
        Fix Version/s 2.1 [ 10022 ]
        Benjamin Eberlei made changes -
        Workflow jira [ 11617 ] jira-feedback [ 13862 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback [ 13862 ] jira-feedback2 [ 15726 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 15726 ] jira-feedback3 [ 17983 ]
        Benjamin Eberlei made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.2 [ 10157 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Roman S. Borschel
            Reporter:
            Benjamin Eberlei
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: