<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Sat May 25 22:57:37 UTC 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://www.doctrine-project.org/jira/si/jira.issueviews:issue-xml/DDC-687/DDC-687.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Doctrine Project</title>
    <link>http://www.doctrine-project.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>5.2.7</version>
        <build-number>850</build-number>
        <build-date>21-02-2013</build-date>
    </build-info>

<item>
            <title>[DDC-687] Add New Entity Attribute &quot;idGetter&quot; to allow accessing the ID without triggering lazy-load</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-687</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Often people present us with the use-case that they want to access the ID of a proxy without loading it.&lt;/p&gt;

&lt;p&gt;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:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$id = $em-&amp;gt;getUnitOfWork()-&amp;gt;getEntityIdentifier($entity-&amp;gt;getRelatedProxy());
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;However we could add a new property here called &quot;idGetter&quot; that would take the name of a method.&lt;/p&gt;

&lt;p&gt;During Proxy Generation then this method is created with magic functionality that:&lt;/p&gt;

&lt;p&gt;1. In case of Single Primary Key returns the single value&lt;br/&gt;
2. In case of Composite Primary Key returns an array of the values in their UoW internal order&lt;br/&gt;
3. Throw an Exception if the method does not exist on the original object&lt;/p&gt;</description>
                <environment></environment>
            <key id="11617">DDC-687</key>
            <summary>Add New Entity Attribute &quot;idGetter&quot; to allow accessing the ID without triggering lazy-load</summary>
                <type id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/newfeature.png">New Feature</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="romanb">Roman S. Borschel</assignee>
                                <reporter username="beberlei">Benjamin Eberlei</reporter>
                        <labels>
                    </labels>
                <created>Mon, 12 Jul 2010 15:00:21 +0000</created>
                <updated>Tue, 25 Jan 2011 08:23:14 +0000</updated>
                                    <version>2.0-BETA2</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="15183" author="stefanklug" created="Tue, 25 Jan 2011 07:26:53 +0000"  >&lt;p&gt;What about an @IdGetter annotation. A function instrumented like this would not trigger the lazy load within the proxy.&lt;/p&gt;

&lt;p&gt;Something like&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;class Entity {
    /** @Id **/
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $id;

    /** @IdGetter **/
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getId() {
       &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;id;
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;would then result in the proxy implementation&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;class EntityProxy &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Entity {
  
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getId() {
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;__isInitialized__) {
            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_identifier;
         } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
             &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; parent::getId();
        }
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;After reading the original post I realized that it proposed nearly the same thing. Nevertheless I&apos;ll leave it here for clarity. I still think that an annotation on a function would be better, than an annotation which gets the function name as a parameter.&lt;/p&gt;

&lt;p&gt;Regards Stefan&lt;/p&gt;</comment>
                    <comment id="15184" author="beberlei" created="Tue, 25 Jan 2011 08:23:14 +0000"  >&lt;p&gt;$this-&amp;gt;_identifier is an array.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>