<!--
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Sat May 25 02:26:24 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/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+DDC+AND+resolution+%3D+Unresolved+AND+component+%3D+ORM+ORDER+BY+priority+DESC&tempMax=1000&field=key&field=summary
-->
<!-- If you wish to do custom client-side styling of RSS, uncomment this:
<?xml-stylesheet href="http://www.doctrine-project.org/jira/styles/jiraxml2html.xsl" type="text/xsl"?>
-->
<rss version="0.92">
    <channel>
        <title>Doctrine Project</title>
        <link>http://www.doctrine-project.org/jira/secure/IssueNavigator.jspa?reset=true&amp;jqlQuery=project+%3D+DDC+AND+resolution+%3D+Unresolved+AND+component+%3D+ORM+ORDER+BY+priority+DESC</link>
        <description>An XML representation of a search request</description>
                <language>en-us</language>
                        <issue start="0" end="152" total="152"/>
                <build-info>
            <version>5.2.7</version>
            <build-number>850</build-number>
            <build-date>21-02-2013</build-date>
        </build-info>
<item>
            <title>[DDC-222] Create unit tests for CLI components</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-222</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description></description>
                <environment></environment>
            <key id="10649">DDC-222</key>
            <summary>Create unit tests for CLI components</summary>
                <type id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/task.png">Task</type>
                                <priority id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/critical.png">Critical</priority>
                    <status id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/reopened.png">Reopened</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="romanb">Roman S. Borschel</reporter>
                        <labels>
                    </labels>
                <created>Tue, 22 Dec 2009 20:04:28 +0000</created>
                <updated>Sat, 30 Oct 2010 13:36:35 +0000</updated>
                                    <version>2.0-ALPHA3</version>
                                <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="13006" author="romanb" created="Wed, 19 May 2010 06:56:56 +0000"  >&lt;p&gt;Whats the status here? Do we have any?&lt;/p&gt;</comment>
                    <comment id="13016" author="guilhermeblanco" created="Wed, 19 May 2010 22:02:17 +0000"  >&lt;p&gt;Since we moved to Symfony Console I don&apos;t think this is needed anymore.&lt;br/&gt;
The purpose of this ticket was actually to test our own CLI support, which was dropped. &lt;/p&gt;

&lt;p&gt;I&apos;m closing the ticket due to this. Reopen if you have any other comment.&lt;/p&gt;</comment>
                    <comment id="13021" author="beberlei" created="Thu, 20 May 2010 05:03:53 +0000"  >&lt;p&gt;I think we do need some basic functional tests of our Commands, they have been subject to many bugs in the past becaues they are not tested.&lt;/p&gt;</comment>
                    <comment id="13373" author="beberlei" created="Sat, 19 Jun 2010 18:30:36 +0000"  >&lt;p&gt;Fixed another fatal error in the command due to missing namespace dependency. We need tests for all the commands, there have been dozens of issues on these things so far.&lt;/p&gt;

&lt;p&gt;This commit shows a simple approach on how testing is easily possible for symfony commands:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://github.com/doctrine/doctrine2/commit/51e6681934a7cf4448b85c5670c04045f66c6056&quot; class=&quot;external-link&quot;&gt;http://github.com/doctrine/doctrine2/commit/51e6681934a7cf4448b85c5670c04045f66c6056&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="14079" author="romanb" created="Thu, 26 Aug 2010 07:58:29 +0000"  >&lt;p&gt;Can we expect some more tests for beta4 or is it unlikely that you find the time? Should we move this further back or does someone else want to step in?&lt;/p&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10001">
                <name>Reference</name>
                                                <inwardlinks description="is referenced by">
                            <issuelink>
            <issuekey id="10929">DDC-359</issuekey>
        </issuelink>
                    </inwardlinks>
                            </issuelinktype>
                    </issuelinks>
                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2332] [UnitOfWork::doPersist()] The spl_objact_hash() generate not unique hash!</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2332</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I created fixtures and some data was inserted many times without calling the &lt;tt&gt;Task&lt;/tt&gt; entity PrePersist event listener.&lt;/p&gt;

&lt;p&gt;I printed the used and generated hash and I saw a &lt;tt&gt;Proxies&amp;#95;&lt;em&gt;CG&lt;/em&gt;_\Asitly\ProjectManagementBundle\Entity\User&lt;/tt&gt; hash equal a &lt;tt&gt;Task&lt;/tt&gt; entity hash!&lt;/p&gt;</description>
                <environment>Symfony 2.1.8, php 5.4.7 and php 5.4.12, Windows 7</environment>
            <key id="14666">DDC-2332</key>
            <summary>[UnitOfWork::doPersist()] The spl_objact_hash() generate not unique hash!</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/critical.png">Critical</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="fchris82">Kriszti&#225;n Ferenczi</reporter>
                        <labels>
                    </labels>
                <created>Tue, 5 Mar 2013 11:20:00 +0000</created>
                <updated>Mon, 1 Apr 2013 21:47:37 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="19808" author="ocramius" created="Tue, 5 Mar 2013 11:23:09 +0000"  >&lt;p&gt;Please provide either a code example or a test case. As it stands, this issue is incomplete&lt;/p&gt;</comment>
                    <comment id="19809" author="beberlei" created="Tue, 5 Mar 2013 11:35:10 +0000"  >&lt;p&gt;Are you calling EntityManager#clear() inbetween? Because PHP reuses the hashes. The ORM accounts for this.&lt;/p&gt;</comment>
                    <comment id="19811" author="beberlei" created="Tue, 5 Mar 2013 12:37:54 +0000"  >&lt;p&gt;This is not a reproduce case, i don&apos;t want to execute your whole project. &lt;/p&gt;

&lt;p&gt;I want to know, what is the actual bug that you see? Can you just print a list of all the hashes? Because the hashes dont differ at the end, bu tjust somewhere in the middle.&lt;/p&gt;</comment>
                    <comment id="19813" author="fchris82" created="Tue, 5 Mar 2013 12:47:24 +0000"  >&lt;p&gt;I attached a hashlogs.txt file. The last Task class hash is 0000000050ab4aba0000000058e1cb12 ( line 3 129 )&lt;/p&gt;

&lt;p&gt;This is not unique, view the line 2 760 . The Task is not being saved and the program don&apos;t call the prePersist listener. The &quot;UnitOfWork&quot; believe the entity has been saved because the &lt;tt&gt;isset($this-&amp;gt;entityStates&lt;span class=&quot;error&quot;&gt;&amp;#91;$oid&amp;#93;&lt;/span&gt;)&lt;/tt&gt; is true. But it is an other entity.&lt;/p&gt;</comment>
                    <comment id="19816" author="fchris82" created="Wed, 6 Mar 2013 01:23:24 +0000"  >&lt;p&gt;The &lt;tt&gt;EntityManager::clear()&lt;/tt&gt; fix the problem, but this is not &quot;good&quot; and &quot;beautiful&quot; solution. Shows no sign of that conflicts were and this is causing the problem. I was looking for the problem 7 hours.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11510" name="hashlogs.txt" size="331693" author="fchris82" created="Tue, 5 Mar 2013 12:47:24 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2237] oracle IN statement with more than 1000 values</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2237</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;If I have a query with a IN statement with more tahn 1000 values I get an sql error.&lt;/p&gt;

&lt;p&gt;I&apos;ve try IN with implode:&lt;br/&gt;
select * from test where id IN(&apos; . implode(&apos;,&apos;, $values) . &apos;)&lt;br/&gt;
and I&apos;ve also try with executeQuery:&lt;br/&gt;
select * from test where id IN(:test)&lt;br/&gt;
  executeQuery($sql, array($values), array(\Doctrine\DBAL\Connection::PARAM_INT_ARRAY))&lt;/p&gt;</description>
                <environment></environment>
            <key id="14376">DDC-2237</key>
            <summary>oracle IN statement with more than 1000 values</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/critical.png">Critical</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="mdrolet">Marc Drolet</reporter>
                        <labels>
                    </labels>
                <created>Fri, 11 Jan 2013 16:34:25 +0000</created>
                <updated>Tue, 2 Apr 2013 12:30:05 +0000</updated>
                                    <version>2.2.2</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="19281" author="mdrolet" created="Fri, 11 Jan 2013 16:47:29 +0000"  >&lt;p&gt;Here is the way I&apos;ve implement the solution on my side: (for oracle)&lt;/p&gt;

&lt;p&gt;into Doctrine/DBAL/Statement.php, I&apos;ve add this method:&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;
/**
     * Binds a parameter value to the statement.
     * This is implemented &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; way &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; oracle only. Other drivers are redirected to bindValue method.
     *
     * The value will be bound with to the type provided (that required to be a table type).
     *
     * @param &lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt; $name The name or position of the parameter.
     * @param Array $value The value of the parameter.
     * @param &lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt; $type The name of the type to use to bind.
     * @&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;boolean&lt;/span&gt; TRUE on success, FALSE on failure.
     */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function bindList($name, Array $value, $type)
    {
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (&apos;oracle&apos; !== $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;platform-&amp;gt;getName())
        {
            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;bindValue($name, $value, $type);
        }
        &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt;
        {
            &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;stmt-&amp;gt;bindList($name, $value, $type);
        }
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;into Doctrine/DBAL/Driver/Statement.php I&apos;ve add:&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;
/**
     * @TODO: docs
     */
    function bindList($param, Array $values, $type);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;into Doctrine/DBAL/Driver/OCI8/OCI8Statement.php I&apos;ve add this method:&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;
/**
     * {@inheritdoc}
     */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function bindList($param, Array $value, $type)
    {
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!($list = oci_new_collection($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_dbh, $type)))
        {
            &lt;span class=&quot;code-comment&quot;&gt;//&lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; OCI8Exception::fromErrorInfo($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;errorInfo());
&lt;/span&gt;        }

        foreach ($value as $entry)
        {
            $list-&amp;gt;append($entry);
        }
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!oci_bind_by_name($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_sth, $param, $list, -1, OCI_B_NTY))
        {
            &lt;span class=&quot;code-comment&quot;&gt;//&lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; OCI8Exception::fromErrorInfo($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;errorInfo());
&lt;/span&gt;        }
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;// NOTE: we should probably add the bindList to all driver Statement object. &lt;/p&gt;

&lt;p&gt;into your code you can use it this way:&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;
$sql = &quot;
    SELECT *
    FROM test
    WHERE id IN
    (
        SELECT *
        FROM
        (
            CAST (: p_ids AS list_int_type)
        )
    )
&quot;;
$stmt = connection-&amp;gt;prepare($sql);
$stmt-&amp;gt;bindList(&apos;: p_ids&apos;, $ids, &apos;list_int_type&apos;);
$stmt-&amp;gt;execute();
$rs = $stmt-&amp;gt;fetchAll(PDO::FETCH_ASSOC);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;NOTE:&lt;br/&gt;
list_int_type need to be a valid oracle data type. You can create one with the name you want.&lt;br/&gt;
example:&lt;br/&gt;
you can have 2 type of accepted array of values:  integer and string&lt;br/&gt;
let&apos;s say we create one for string named: list_str_type  and one for integer list_int_type&lt;/p&gt;

&lt;p&gt; create or replace type list_str_type as table of varchar2(4000);&lt;br/&gt;
 create or replace type list_int_type as table of number;&lt;/p&gt;</comment>
                    <comment id="19924" author="beberlei" created="Mon, 1 Apr 2013 21:44:51 +0000"  >&lt;p&gt;Hey &lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=mdrolet&quot; class=&quot;user-hover&quot; rel=&quot;mdrolet&quot;&gt;Marc Drolet&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;thanks for the feedback and the solution, however i would like to have something generic that is working independent of the database driver. This code is very specific.&lt;/p&gt;

&lt;p&gt;Can you point me to some documentation why oci collection works with more than 1000 elements and how it works in PHP?&lt;/p&gt;</comment>
                    <comment id="19929" author="mdrolet" created="Tue, 2 Apr 2013 12:30:05 +0000"  >&lt;p&gt;Hi Benjamin,&lt;/p&gt;

&lt;p&gt;The limitation is not from the oci driver, it&apos;s an oracle limitation.  There are a couple of possible solution/implementation that can be done but the one I&apos;ve provide is the one that perform better for the test I&apos;ve done and from what I can found over the blogs I&apos;ve read.&lt;/p&gt;

&lt;p&gt;I can&apos;t find the exact documentation of oracle.  oracle doc is so poor. &lt;br/&gt;
Here is the best description link I can provide that describe some possible implementation.&lt;br/&gt;
&lt;a href=&quot;http://vsadilovskiy.wordpress.com/substituting-a-collection-for-in-list-performance-study/&quot; class=&quot;external-link&quot;&gt;http://vsadilovskiy.wordpress.com/substituting-a-collection-for-in-list-performance-study/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I don&apos;t know if there is similar limitation with other database.  With the implementation I&apos;ve provided, It will be possible to implement the proper solution depending on the database limitation you face otherwise it will execute the generic IN. What&apos;s bad, we need to create the type into the database.&lt;/p&gt;

&lt;p&gt;NOTE: In my case, I can not perform a sub-query, I get the my collection from a web service call.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-851] Automerge of detached entities passed to doctrine</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-851</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;This is a feature request.&lt;/p&gt;

&lt;p&gt;Currently it is not possible to assign a detached entity to a relationship. You have to manually &quot;merge&quot; it, and only then you are able to assign it to relationships of managed objects.&lt;/p&gt;

&lt;p&gt;This can become complicated to do. The way it is now, when assigning an entity to a relationship in a process using a large number of entities, the entity&apos;s state needs to be checked and the entity possibly merged - all in userland code. This adds a level of complexity and potential for errors, while it could be solved transparently and elegantly within the ORM. There are ways to implement it in userland code, too, with moderate effort (see below), but this does not change the fact that responsibility for implementing a purely technical feature is delegated to the user, who could be spending his time much better writing business code. And if the user actually implements it, it will clutter the application with non-problem-domain code.&lt;/p&gt;

&lt;p&gt;To keep things simple, I propose Doctrine be extended to simply auto-merge any detached entities passed to it. That would save the programmer the manual tracking of object states and merge() calls.&lt;/p&gt;

&lt;p&gt;This would be especially handy when using cascades, as keeping track of deep object graphs in userland code would duplicate substantial ORM functionality.&lt;/p&gt;

&lt;p&gt;In programs that work with massive amounts of data, it is practically impossible to keep all entities managed due to resource constraints (see e.g. the batch processing patterns documented in the Doctrine 2 reference at &lt;a href=&quot;http://www.doctrine-project.org/projects/orm/2.0/docs/reference/batch-processing/en&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/projects/orm/2.0/docs/reference/batch-processing/en&lt;/a&gt;). In a situation like that, one would probably simply flush and clear the entity manager regularly. Doctrine 2 currently forces the user to manually &quot;merge&quot; all persistent objects he/she still holds references to and wants to assign e.g. to other newly created persistable objects. I can not think of any reason why Doctrine 2 should not be able to do it automatically.&lt;/p&gt;


&lt;p&gt;Below is another comment originally attached to the GitHub proposal, containing a userland implementation of the feature as a temporary fix, for whoever cares.&lt;/p&gt;

&lt;p&gt;Here is a userland implementation for the functionality I am proposing, though I feel it is technical clutter that belongs into the ORM. Changing doctrine to be able to auto-merge unmanaged entities would be ideal. I thought I&apos;d share this, for use as long as Doctrine 2 does not provide equivalent functionality. The implementation assumes all entities inherit from a base class (named &quot;YourEntityBaseClass here&quot;) and intercepts the assignment to ToOne-relationships in a __set() method provided in that base class. For ToMany-relationships we extend ArrayCollection to intercept calls to add() and set() to accomplish the same.&lt;/p&gt;

&lt;p&gt;As an alternative to defining a __set() method in a base class you could also implement the interception by changing any mutator methods you define in your entities. But that would bloat your code quickly as you define more and more relationship attributes on your entities.&lt;/p&gt;

&lt;p&gt;The following __set() method implementation relies on reflection to parse the DocBlock-Comment with the Annotation and determine whether or not the property to be set is a ToOne-relationship.&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;
   &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function __set($name, &amp;amp;$value) {
      
      $reflectionClass = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; ReflectionClass($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;);
      
      $property = $reflectionClass-&amp;gt;getProperty($name);

      &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (   self::isToOneRelationship($property)
          &amp;amp;&amp;amp; $value !== &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;) {
            
         $value = self::mergeIfDetached($value);
      }
      
      $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;$name = $value;
   }

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The following is an implementation of mergeIfDetached(), that assumes there is a __get defined on the entity, to be able to access the protected mapped properties.&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;
&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; function mergeIfDetached(YourEntityBaseClass $dataObject) {

   $doctrineEntityManager = DB::getDoctrineEntityManager();

   &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($doctrineEntityManager-&amp;gt;getUnitOfWork()-&amp;gt;getEntityState($dataObject) == \Doctrine\ORM\UnitOfWork::STATE_DETACHED) {
       
      $dataObject = $doctrineEntityManager-&amp;gt;merge($dataObject);
   }

   &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $dataObject;
}

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;For your purposes, consider DB to be just a class holding a reference to the Doctrine entity manager.&lt;/p&gt;

&lt;p&gt;Here are the helper methods for the reflection:&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;
   &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; function isToOneRelationship(ReflectionProperty $property) {

      &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; self::matchDoctrineAnnotation($property, self::$doctrineToOneRelationshipAnnotation);
   }

   &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; function matchDoctrineAnnotation(ReflectionProperty $property, $pattern) {
      
      &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; preg_match(&apos;/\@&apos; . $pattern . &apos;/&apos;, $property-&amp;gt;getDocComment()) != 0;
   }

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Here is the drop-in-replacement class for use with ToMany-Relationships. It uses the static reloadIfDetached method defined in the entity base class:&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;
use Doctrine\Common\Collections\ArrayCollection;


class Collection &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; ArrayCollection {
   
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function set($key, $value) {
       
       $value = YourEntityBaseClass::mergeIfDetached($value);
       
       parent::set($key, $value);
    }


    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function add($value) {
       
       $value = YourEntityBaseClass::mergeIfDetached($value);
       
       &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; parent::add($value);
    }
}

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This approach keeps the amount of unnecessary code to a minimum, so that merges are not scattered throughout the problem-domain code.&lt;/p&gt;</description>
                <environment></environment>
            <key id="12049">DDC-851</key>
            <summary>Automerge of detached entities passed to doctrine</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="dalvarez">Daniel Alvarez Arribas</reporter>
                        <labels>
                    </labels>
                <created>Sun, 31 Oct 2010 22:52:26 +0000</created>
                <updated>Thu, 30 Dec 2010 05:55:17 +0000</updated>
                                    <version>2.0-BETA4</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="15057" author="dalvarez" created="Wed, 29 Dec 2010 18:53:03 +0000"  >&lt;p&gt;I have to note that the code I listed above turned out to be broken. There is nothing that guarantees that a data object just merged will not become detached again after being merged on assignment, unless the object is immediately persisted afterwards.&lt;/p&gt;

&lt;p&gt;The correct solution would be to merge all data objects found through relationships for a given data object, right from the persistence manager, immediately before calling persist() on the data object.&lt;/p&gt;

&lt;p&gt;I am currently using this solution (save() saves a data object safely for use within long-running batch jobs):&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;
   &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; function save(DataObject $dataObject) {
      
      self::mergeRelatedDataObjectsIfDetached($dataObject);
      
      self::$doctrineEntityManager-&amp;gt;persist($dataObject);
   }
   

   &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; function merge(DataObject $dataObject) {
      
      &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; self::$doctrineEntityManager-&amp;gt;merge($dataObject);
   }


  &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; function mergeRelatedDataObjectsIfDetached(DataObject $dataObject) {
      
      $reflectionClass = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; ReflectionClass($dataObject);
      
      $properties = $reflectionClass-&amp;gt;getProperties();
      
      foreach ($properties as $property) {

         $propertyName = $property-&amp;gt;getName();
         
         $propertyValue = $dataObject-&amp;gt;__get($propertyName);
         
         
         &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (MetadataReader::isToOneRelationship($property)) {
            
            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (   $propertyValue !== &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;
                &amp;amp;&amp;amp; ! $propertyValue &lt;span class=&quot;code-keyword&quot;&gt;instanceof&lt;/span&gt; Proxy
                &amp;amp;&amp;amp; self::isDetached($propertyValue)) {
               
               $relatedDataObject = self::merge($propertyValue);
               
               $dataObject-&amp;gt;__set($propertyName, $relatedDataObject);
            }
         }
         &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
            
            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (MetadataReader::isToManyRelationship($property)) {
               
               $relatedDataObjects = $propertyValue-&amp;gt;toArray();
               
               foreach ($relatedDataObjects as $index =&amp;gt; $relatedDataObject) {
                  
                  &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ( ! $relatedDataObject &lt;span class=&quot;code-keyword&quot;&gt;instanceof&lt;/span&gt; Proxy
                      &amp;amp;&amp;amp; self::isDetached($relatedDataObject)) {
                     
                     $relatedDataObject = self::merge($relatedDataObject);
                     
                     
                     &lt;span class=&quot;code-comment&quot;&gt;// Replace the entry in the collection with the merged copy.
&lt;/span&gt;                     
                     $propertyValue-&amp;gt;set($index, $relatedDataObject);
                  }
               }
            }
         }
      }
   }
   
   
   &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; function isDetached(DataObject $dataObject) {
      
      &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; self::$doctrineEntityManager-&amp;gt;getUnitOfWork()-&amp;gt;getEntityState($dataObject) == UnitOfWork::STATE_DETACHED;
   }

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;


&lt;p&gt;I still wish there would be an automerge feature, kind of Hibernate&apos;s &quot;update&quot;.&lt;/p&gt;</comment>
                    <comment id="15058" author="dalvarez" created="Wed, 29 Dec 2010 18:55:14 +0000"  >&lt;p&gt;Wrapped the code sections into proper code blocks...&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-821] Consider adding Query-Join as another join method for DQL</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-821</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Some ORM systems support an alternative to fetch-join queries, called a &quot;query-join&quot;.  See &lt;a href=&quot;http://www.avaje.org/ebean/introquery_joinquery.html&quot; class=&quot;external-link&quot;&gt;http://www.avaje.org/ebean/introquery_joinquery.html&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A query-join accomplishes the same as a fetch-join (hydrating a larger object graph across all associations types) but executes more than one SQL query in sequence in order to hydrate the requested portions of the graph in a result set.  The first query retrieves data from the base entity/table and the next queries retrieve the data for the requested associations.&lt;/p&gt;

&lt;p&gt;In some cases this approach is more efficient to a fetch-join:&lt;/p&gt;

&lt;p&gt;(1) &lt;b&gt;No data duplication in the SQL result&lt;/b&gt; as occurs in a fetch-join on to-many associations.  Instead, this data is loaded through a second query.  This saves network traffic, memory and general overhead in hydrating the returned results.  In the case where large TEXT data is included in result sets, the savings here may be substantial.&lt;/p&gt;

&lt;p&gt;(2) &lt;b&gt;setFirstResult() and setMaxResult() are again effective (for pagination)&lt;/b&gt; and more importantly more efficient on these query-joins.  The current DoctrineExtension solution to enable pagination on fetch-joins requires a series of queries to determine the target primary keys of the root entity of the query.  The primary key lookup query requires DISTINCT or GROUP BY &amp;#8211; which often triggers filesorts, temporary tables, etc (at least on MySQL) and greatly slows down the query.  Query joins would not require this. &lt;/p&gt;

&lt;p&gt;Possible implementation example:&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;
&lt;span class=&quot;code-comment&quot;&gt;// existing fetch-join
&lt;/span&gt;$query = $em-&amp;gt;createQuery(&apos;SELECT c, o FROM Customers c JOIN c.orders o&apos;);
$query-&amp;gt;setFirstResult(10)-&amp;gt;setMaxResult(20); &lt;span class=&quot;code-comment&quot;&gt;// doesn&apos;t &lt;span class=&quot;code-keyword&quot;&gt;do&lt;/span&gt; what you&apos;d hope it would &lt;span class=&quot;code-keyword&quot;&gt;do&lt;/span&gt;, no ability to use &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; pagination
&lt;/span&gt;$customersAndOrders = $query-&amp;gt;getResult(); &lt;span class=&quot;code-comment&quot;&gt;// array of Customer objects with Orders hydrated
&lt;/span&gt;
&lt;span class=&quot;code-comment&quot;&gt;// proposed query-join
&lt;/span&gt;$query = $em-&amp;gt;createQuery(&apos;SELECT c, o FROM Customers c QUERY JOIN c.orders o&apos;);
$query-&amp;gt;setFirstResult(10)-&amp;gt;setMaxResult(20); &lt;span class=&quot;code-comment&quot;&gt;// now works &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; pagination
&lt;/span&gt;$customersAndOrders = $query-&amp;gt;getResult(); &lt;span class=&quot;code-comment&quot;&gt;// array of Customer objects with Orders hyrdated
&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt;// &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; would execute a series of queries -- i.e. in SQL
&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt;// SELECT ... FROM customers LIMIT 10, 20
&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt;// SELECT ... FROM orders WHERE customer_id IN (.....)&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and/or,  could there be a way to trigger a &quot;query-join&quot; against an existing array of entities?  for example&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;$query = $em-&amp;gt;createQuery(&apos;SELECT c FROM Customers c&apos;); &lt;span class=&quot;code-comment&quot;&gt;// single query to fetch customers
&lt;/span&gt;$customers = $query-&amp;gt;getResult(); &lt;span class=&quot;code-comment&quot;&gt;// array of Customer objects
&lt;/span&gt;$em-&amp;gt;join($customers, &apos;orders&apos;); &lt;span class=&quot;code-comment&quot;&gt;// fetch and hydrate the &apos;orders&apos; association on each Customer using a single query&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Perhaps at some point in the future Doctrine/DBAL could even make use of asynchronous queries (i.e. mysqlnd supports this) to allow these query-joins to run in parallel and the result would be more efficient paginated resultsets.&lt;/p&gt;

&lt;p&gt;Thoughts/feedback?&lt;/p&gt;</description>
                <environment></environment>
            <key id="11962">DDC-821</key>
            <summary>Consider adding Query-Join as another join method for DQL</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="mjh_ca">Marc Hodgins</reporter>
                        <labels>
                    </labels>
                <created>Wed, 29 Sep 2010 15:14:23 +0000</created>
                <updated>Wed, 29 Dec 2010 00:49:46 +0000</updated>
                                                    <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="14494" author="beberlei" created="Thu, 30 Sep 2010 03:50:53 +0000"  >&lt;p&gt;There is another approach for this using several subqueries to build an IN clause, the Paginator extension supports this: &lt;a href=&quot;http://github.com/beberlei/DoctrineExtensions&quot; class=&quot;external-link&quot;&gt;http://github.com/beberlei/DoctrineExtensions&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I rather go the extension approach than changing the DQL for this feature.&lt;/p&gt;</comment>
                    <comment id="14497" author="beberlei" created="Thu, 30 Sep 2010 04:31:13 +0000"  >&lt;p&gt;I just saw your second example, that is rather cool though and gets +1 from me.&lt;/p&gt;

&lt;p&gt;I had the same idea for &quot;not initialized proxies&quot;, i.e.&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;$em-&amp;gt;getUnitOfWork()-&amp;gt;initializeProxies(&apos;Customer&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="15051" author="mjh_ca" created="Wed, 29 Dec 2010 00:49:46 +0000"  >&lt;p&gt;Second example is a duplicate of &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-734&quot; title=&quot;Possibility to fetch all outstanding proxies of an Entity&quot;&gt;&lt;del&gt;DDC-734&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-785] Post-Post-Persist event</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-785</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;postPersist/postUpdate events are triggered in the middle of a unitOfWork, and querying the DB in such events causes infinite loops. Doctrine attempts to flush the entity manager before running any query, which triggers flushing of entities, and postPersist/postUpdate events are triggered again.&lt;/p&gt;

&lt;p&gt;I did not checked, but the flush() before each query may be a performance problem too, if doctrine has to determine what has changed, depending on the changetracking policy.&lt;/p&gt;

&lt;p&gt;Also, it would be great if postPersist / postUpdate events were triggered after all entities have been persisted. It looks like that entities are flushed by groups of same &apos;type&apos;, and that events for a type are triggered once all of the elements of that group have been flushed, potentially before entities of an other type have been flushed : postPersist / postUpdate events are triggered while some other entities are still not flushed.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11874">DDC-785</key>
            <summary>Post-Post-Persist event</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="arnaud-lb">arnaud-lb</reporter>
                        <labels>
                    </labels>
                <created>Thu, 2 Sep 2010 16:08:16 +0000</created>
                <updated>Fri, 14 Jan 2011 03:11:48 +0000</updated>
                                    <version>2.0-BETA4</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="14250" author="beberlei" created="Fri, 3 Sep 2010 03:10:08 +0000"  >&lt;p&gt;That is documented and for perfomance reasons we cannot move the preUpdate/postUpdate/prePersist/postPersist events to other locations inside the UnitOfWork.&lt;/p&gt;

&lt;p&gt;There is an onFlush event that allows for more flexibility and is triggered before any update/insert/delete is done by the UnitOfWork.&lt;/p&gt;
</comment>
                    <comment id="14274" author="arnaud-lb" created="Sat, 4 Sep 2010 08:09:58 +0000"  >&lt;p&gt;Thanks.&lt;/p&gt;

&lt;p&gt;I understand that. Is there any chance of getting some onPostFlush or similar, which would be triggered like onFlush, but after all update/insert/delete ? Or just some post-something event which is allowed to issue db queries.&lt;/p&gt;</comment>
                    <comment id="14458" author="gediminasm" created="Fri, 24 Sep 2010 10:02:13 +0000"  >&lt;p&gt;onFlush you can store your entity for furher processing and on postPersist you can check if there are no more insertions and process the entity if it needs additional query&lt;br/&gt;
I have faced all these issues and you can check &lt;a href=&quot;http://github.com/l3pp4rd/DoctrineExtensions/tree/master/lib/DoctrineExtensions/Translatable/&quot; class=&quot;external-link&quot;&gt;http://github.com/l3pp4rd/DoctrineExtensions/tree/master/lib/DoctrineExtensions/Translatable/&lt;/a&gt;&lt;br/&gt;
for a solution to your problem&lt;/p&gt;</comment>
                    <comment id="15140" author="gediminasm" created="Fri, 14 Jan 2011 03:11:48 +0000"  >&lt;p&gt;I think this issue should be closed since the main reason of opening it was the possibility to execute additional queries when inserts were pending in unit of work. In current release it does not cause a flush during an additional query execution anymore.  &lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-779] Doctrine\ORM\Configuration should be immutable after construction of EntityManager</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-779</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Currently the Doctrine\ORM\Configuration instance is not immutable after construction of the EM, which can lead to funny behavior when changing essential dependencies such as caches or others.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11850">DDC-779</key>
            <summary>Doctrine\ORM\Configuration should be immutable after construction of EntityManager</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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, 30 Aug 2010 16:23:27 +0000</created>
                <updated>Mon, 30 Aug 2010 16:23:27 +0000</updated>
                                    <version>2.0-BETA3</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1285] Select by multiple ids</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1285</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;How do you look at adding findByIds(array $ids) to EntityManager and UnitOfWork? This would allow fetching multiple entities from a database at one request and would be very useful for caching - there would be even some kind of IdentityMap kept in memcached or any other caching engine, that supports multiple id retrieval: i&apos;ve been using such an architecture in multiple projects and it turned out to be very effective. There were two basic methods - findIdsByFilter(array $filter) and findEntitiesByIds(array $ids). The latter one had a caching proxy, replicating entities to a cache storage. If this idea proceeds - I&apos;d be glad to cover it with more details.&lt;/p&gt;

&lt;p&gt;This topic on StackOverflow could also help:&lt;br/&gt;
&lt;a href=&quot;http://stackoverflow.com/questions/276709/design-pattern-for-memcached-data-caching&quot; class=&quot;external-link&quot;&gt;http://stackoverflow.com/questions/276709/design-pattern-for-memcached-data-caching&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
            <key id="12842">DDC-1285</key>
            <summary>Select by multiple ids</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/inprogress.png">In Progress</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="serge.smertin">Serge Smertin</reporter>
                        <labels>
                    </labels>
                <created>Fri, 22 Jul 2011 12:30:34 +0000</created>
                <updated>Fri, 11 Jan 2013 01:13:32 +0000</updated>
                                                    <fixVersion>2.x</fixVersion>
                                <component>Mapping Drivers</component>
                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="17071" author="guilhermeblanco" created="Tue, 20 Dec 2011 22:21:15 +0000"  >&lt;p&gt;Updating fix version&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1262] Have proxies copy docblocks aswell</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1262</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Whenever a Proxy is generated it does not copy the docblocks.&lt;/p&gt;

&lt;p&gt;This means when you do something like &quot;$refl = new ReflectionObject($proxy)&quot; you might be in trouble.&lt;/p&gt;

&lt;p&gt;However if we add docblocks then we have to make sure that proxies do not magically appear as entities by throwing an exception in the AnnotationDriver.&lt;/p&gt;</description>
                <environment></environment>
            <key id="12805">DDC-1262</key>
            <summary>Have proxies copy docblocks aswell</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="beberlei">Benjamin Eberlei</reporter>
                        <labels>
                    </labels>
                <created>Sat, 9 Jul 2011 12:29:21 +0000</created>
                <updated>Sat, 9 Jul 2011 12:29:21 +0000</updated>
                                    <version>2.0.6</version>
                <version>2.1</version>
                <version>Git Master</version>
                                <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1219] Remove dependancy on Collection interface in Domain Objects</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1219</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Short: This issue is all about being able to use doctrine with naked domain objects without any use of doctrine classes.&lt;br/&gt;
I &apos;m not talking about PersistentCollection here, fully aware of that being tied into Doctrine, but those are injected, this is all about code dependency on ArrayCollection.&lt;/p&gt;


&lt;p&gt;Seems like some of the UnitOfWork code is cable of handling other types of arrays, like:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;    // If $actualData[$name] is not a Collection then use an ArrayCollection.
    if ( ! $actualData[$name] instanceof Collection) {
        $actualData[$name] = new ArrayCollection($actualData[$name]);
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;But in __cascade* functions this is not the case in all but two:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;    if ($relatedEntities instanceof Collection) {
        if ($relatedEntities instanceof PersistentCollection) {
            // Unwrap so that foreach() does not initialize
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;2 however have:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;    if (($relatedEntities instanceof Collection || is_array($relatedEntities))) {
        if ($relatedEntities instanceof PersistentCollection) {
            // Unwrap so that foreach() does not initialize
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;


&lt;p&gt;Would it be an idea to do &quot;instanceof Traversable&quot; instead of &quot; instanceof Collection&quot;? &lt;/p&gt;</description>
                <environment></environment>
            <key id="12730">DDC-1219</key>
            <summary>Remove dependancy on Collection interface in Domain Objects</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="anderom">Andr&#233; R.</reporter>
                        <labels>
                    </labels>
                <created>Tue, 21 Jun 2011 11:13:39 +0000</created>
                <updated>Mon, 4 Jul 2011 21:47:46 +0000</updated>
                                    <version>2.1</version>
                                <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="16035" author="anderom" created="Tue, 21 Jun 2011 11:21:07 +0000"  >&lt;p&gt;Note: If the fist code block is always performed before the last 2 blocks then there is no issue here, just a need to make it more clear in Doc that this is possible but that you should not rely custom implementation as PersistentCollection will be injected when loaded from db.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1200] Derived Id Generator</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1200</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;For usage with the foreign key as primary key features described in &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-117&quot; title=&quot;Allow @Id on @ManyToOne fields&quot;&gt;&lt;del&gt;DDC-117&lt;/del&gt;&lt;/a&gt; a derived id generator would be tons of useful. It is essentially a post generate id generator (sort of late pre insert though) assigned generator.&lt;/p&gt;</description>
                <environment></environment>
            <key id="12705">DDC-1200</key>
            <summary>Derived Id Generator</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="beberlei">Benjamin Eberlei</reporter>
                        <labels>
                    </labels>
                <created>Thu, 9 Jun 2011 20:46:56 +0000</created>
                <updated>Wed, 9 Nov 2011 21:41:30 +0000</updated>
                                    <version>Git Master</version>
                                <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>3</votes>
                        <watches>5</watches>
                        <comments>
                    <comment id="16788" author="yourwebmaker" created="Wed, 9 Nov 2011 21:41:30 +0000"  >&lt;p&gt;When this will be fixed?&lt;/p&gt;

&lt;p&gt;I think this is related to &lt;a href=&quot;http://groups.google.com/group/doctrine-user/browse_thread/thread/7e1cfa9c4c99af31&quot; class=&quot;external-link&quot;&gt;http://groups.google.com/group/doctrine-user/browse_thread/thread/7e1cfa9c4c99af31&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10000">
                <name>Duplicate</name>
                                                <inwardlinks description="is duplicated by">
                            <issuelink>
            <issuekey id="12891">DDC-1315</issuekey>
        </issuelink>
                    </inwardlinks>
                            </issuelinktype>
                    </issuelinks>
                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1197] Proxies should handle variable argument lists</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1197</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;This is a contingency issue for &lt;a href=&quot;https://github.com/doctrine/doctrine2/pull/60&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/pull/60&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&quot;Fix to allow for proxy generated classes to respect methods in parent which may use func_get_args internally. Previously they would be passed nothing and thus fail. Also reduces need to build up argumentString. &quot;&lt;/p&gt;</description>
                <environment></environment>
            <key id="12699">DDC-1197</key>
            <summary>Proxies should handle variable argument lists</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="beberlei">Benjamin Eberlei</reporter>
                        <labels>
                    </labels>
                <created>Sun, 5 Jun 2011 08:52:14 +0000</created>
                <updated>Sun, 5 Jun 2011 08:52:14 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1144] How insert a AES_ENCRYPT value in a table field</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1144</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Hi there,&lt;br/&gt;
I&apos;m trying to insert an encrypted data:&lt;/p&gt;

&lt;p&gt;Because &apos;&quot;INSERT statements are not allowed in DQL, ....&quot; i processed like this:&lt;br/&gt;
&amp;lt;?php&lt;br/&gt;
...&lt;br/&gt;
// controller&lt;br/&gt;
$membre = new \Entity\TMembre();&lt;br/&gt;
$membre-&amp;gt;setPassword($password);&lt;br/&gt;
$em-&amp;gt;persist($membre);&lt;br/&gt;
$em-&amp;gt;flush();&lt;br/&gt;
...&lt;br/&gt;
?&amp;gt;&lt;br/&gt;
//entity&lt;br/&gt;
&amp;lt;?php&lt;br/&gt;
namespace Entity;&lt;br/&gt;
/**&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;TMembre&lt;br/&gt;
 *&lt;/li&gt;
	&lt;li&gt;@Table(name=&quot;t_membre&quot;)&lt;/li&gt;
	&lt;li&gt;@Entity(repositoryClass=&quot;Repository\TMembreRepository&quot;)&lt;br/&gt;
 */&lt;br/&gt;
class TMembre&lt;br/&gt;
{&lt;br/&gt;
    /**&lt;/li&gt;
	&lt;li&gt;Set password     *&lt;/li&gt;
	&lt;li&gt;@param string $password     */&lt;br/&gt;
    public function setPassword($password)
    {
    	$this-&amp;gt;email = &quot;AES_ENCRYPT(&apos;&quot;.$email.&quot;&apos;,&apos;&quot;._MYSQL_CRYPT.&quot;&apos;)&quot;; =&amp;gt; insert this entire string without executing encryption
    	$this-&amp;gt;email = new \Doctrine\ORM\Query\Expr\Func(&quot;AES_ENCRYPT&quot;,array(&quot;&apos;&quot;.$email.&quot;&apos;&quot;,&quot;&apos;&quot;._MYSQL_CRYPT.&quot;&apos;&quot;)); =&amp;gt; does not work
    }
&lt;p&gt;}&lt;br/&gt;
?&amp;gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;How can i do ?&lt;br/&gt;
Add this method to Doctrine\ORM\Query\Expr class ?&lt;/p&gt;

&lt;p&gt;/**&lt;br/&gt;
    public function aesEncrypt($value)&lt;/p&gt;
    {
       return &quot;AES_ENCRYPT(&apos;&quot;.$value.&quot;&apos;,&apos;&quot;._MYSQL_CRYPT.&quot;&apos;)&quot;
    }

&lt;p&gt;Best regards&lt;/p&gt;

&lt;p&gt;David&lt;/p&gt;</description>
                <environment>Win XP, MySql5, Php5.3, ZendFramework 1.11.4</environment>
            <key id="12626">DDC-1144</key>
            <summary>How insert a AES_ENCRYPT value in a table field</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="dquintard">dquintard</reporter>
                        <labels>
                    </labels>
                <created>Tue, 10 May 2011 19:58:28 +0000</created>
                <updated>Tue, 10 May 2011 19:58:28 +0000</updated>
                                    <version>2.0.4</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1137] SchemaTool#getUpdateSchemaSql() does not respect database identifier in table names</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1137</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Given two databases, &apos;foo&apos; and &apos;bar&apos;, with entities in /Entities/Foo/ annotated as follows:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;/**
 * Test
 *
 * @Table(name=&quot;foo.test&quot;)
 * @Entity
 */
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Create an EntityManager instance with &lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;$connectionOptions = array( 
    &apos;dbname&apos; =&amp;gt; &apos;Foo&apos;, 
    &apos;driver&apos; =&amp;gt; &apos;pdo_mysql&apos;, 
    &amp;lt;..etc..&amp;gt;
);&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Use EntityManager#getClassMetaData( &quot;Entities\\Foo&lt;br class=&quot;atl-forced-newline&quot; /&gt;Test&quot; ) to pass to SchemaTool#createSchema() and Doctrine appropriately creates a database table foo.test&lt;/p&gt;

&lt;p&gt;Use EntityManager#getClassMetaData( &quot;Entities\\Foo&lt;br class=&quot;atl-forced-newline&quot; /&gt;Test&quot; ) to pass to SchemaTool#updateSchema() and Doctrine fails with Exception&lt;br/&gt;
-&amp;gt; SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;42S01&amp;#93;&lt;/span&gt;: Base table or view already exists: 1050 Table &apos;test&apos; already exists&lt;/p&gt;

&lt;p&gt;Inserting&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;die( print_r( $fromSchema, 1 ) . print_r( $toSchema, 1 ) . print_r( $schemaDiff, 1 ) );&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;into Doctrine/ORM/Tools/SchemaTool.php line 632 shows $fromSchema outputs&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;[_tables:protected] =&amp;gt; Array
        (
            [test]&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;but $toSchema outputs&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;[_tables:protected] =&amp;gt; Array
        (
            [foo.test]&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;which causes $schemaDiff to output&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;[newTables] =&amp;gt; Array
        (
            [foo.test]&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In summary, Doctrine/DBAL/Schema/Comparator considers foo.test a new table, because Doctrine/DBAL/Schema/AbstractSchemaManager lists its table as &quot;test&quot; rather than &quot;foo.test&quot;. &lt;/p&gt;
</description>
                <environment>Linux 2.6.18-194.32.1.el5.centos.plus x86_64 GNU/Linux&lt;br/&gt;
</environment>
            <key id="12614">DDC-1137</key>
            <summary>SchemaTool#getUpdateSchemaSql() does not respect database identifier in table names</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="hlomas">Hugh Lomas</reporter>
                        <labels>
                    </labels>
                <created>Thu, 5 May 2011 17:23:11 +0000</created>
                <updated>Sat, 14 May 2011 10:10:20 +0000</updated>
                                    <version>2.0.4</version>
                                                <component>ORM</component>
                <component>Tools</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="15808" author="hlomas" created="Thu, 5 May 2011 18:37:09 +0000"  >&lt;p&gt;It seems that changing AbstractSchemaManager.php to the following corrected the issue for me, however I am not sure of any repercussions that may arise as a result, being unfamiliar with the codebase.&lt;/p&gt;

&lt;div class=&quot;panel&quot; style=&quot;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-style: solid;&quot;&gt;&lt;b&gt;Doctrine/DBAL/Schema/AbstractSchemaManager.php line 228&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;panelContent&quot;&gt;
&lt;p&gt;return new Table( $tableName, $columns, $indexes, $foreignKeys, false, array());&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;panel&quot; style=&quot;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-style: solid;&quot;&gt;&lt;b&gt;Doctrine/DBAL/Schema/AbstractSchemaManager.php line 228&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;panelContent&quot;&gt;
&lt;p&gt;return new Table( &lt;font color=&quot;green&quot;&gt;$this-&amp;gt;_conn-&amp;gt;getDatabase() . &quot;.&quot; . &lt;/font&gt; $tableName, $columns, $indexes, $foreignKeys, false, array());&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;
</comment>
                    <comment id="15850" author="beberlei" created="Sat, 14 May 2011 10:10:09 +0000"  >&lt;p&gt;Multi databases are not supported by schema manager and schema tool yet.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1106] Wrong inversedBy in example</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1106</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;on page &lt;a href=&quot;http://www.doctrine-project.org/docs/orm/2.0/en/reference/working-with-objects.html&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/docs/orm/2.0/en/reference/working-with-objects.html&lt;/a&gt;&lt;br/&gt;
section :  8.1. Association Example Entities, first example. Please see the .jpg in attachement(it explains clearly what I think is an error)&lt;br/&gt;
Regards.&lt;/p&gt;</description>
                <environment></environment>
            <key id="12547">DDC-1106</key>
            <summary>Wrong inversedBy in example</summary>
                <type id="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/documentation.png">Documentation</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="cristobal">cristobal castro</reporter>
                        <labels>
                    </labels>
                <created>Thu, 7 Apr 2011 20:09:29 +0000</created>
                <updated>Thu, 7 Apr 2011 20:09:29 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                    <attachment id="10967" name="screen-shot.zip" size="200671" author="cristobal" created="Thu, 7 Apr 2011 20:09:29 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1032] ensure the dateformat Y-m-d gets used by the MsSQL-Server 2005</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1032</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;To ensure that the MsSQL-Server 2005 (and maybe higher) uses the format that is specified in the MsSqlPlatform class (Y-m-d)&lt;br/&gt;
set it via &apos;SET DATEFORMAT ymd&apos; .&lt;/p&gt;

&lt;p&gt;This should be done directly after the connection has be opened.&lt;/p&gt;</description>
                <environment>php5.3.5; MsSQL-Server 2005; W2K8; Apache2; MS pdo_sqlsrv_ts_vc6 driver</environment>
            <key id="12386">DDC-1032</key>
            <summary>ensure the dateformat Y-m-d gets used by the MsSQL-Server 2005</summary>
                <type id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/subtask_alternate.png">Sub-task</type>
                    <parent id="12379">DDC-1028</parent>
                        <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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="le_shatai">Martin Weise</reporter>
                        <labels>
                    </labels>
                <created>Mon, 14 Feb 2011 11:09:21 +0000</created>
                <updated>Mon, 14 Feb 2011 11:10:57 +0000</updated>
                                    <version>2.0.1</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="15306" author="le_shatai" created="Mon, 14 Feb 2011 11:10:57 +0000"  >&lt;p&gt;Issue created as wished from Juozas Kaziukenas.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1025] Please repalce &apos;Doctrine\XXX\YYY&apos; with &apos;\Doctrine\XXX\YYY&apos; in code and document</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1025</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;It will help us use the namespace and code autocomplete in some IDE.&lt;/p&gt;</description>
                <environment></environment>
            <key id="12370">DDC-1025</key>
            <summary>Please repalce &apos;Doctrine\XXX\YYY&apos; with &apos;\Doctrine\XXX\YYY&apos; in code and document</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="wsyb">ben yan</reporter>
                        <labels>
                    </labels>
                <created>Wed, 9 Feb 2011 21:33:28 +0000</created>
                <updated>Tue, 13 Dec 2011 20:41:16 +0000</updated>
                                    <version>2.0.1</version>
                                                <component>Documentation</component>
                <component>DQL</component>
                <component>Mapping Drivers</component>
                <component>ORM</component>
                <component>Tools</component>
                        <due></due>
                    <votes>7</votes>
                        <watches>6</watches>
                        <comments>
                    <comment id="15717" author="matthieu" created="Fri, 8 Apr 2011 17:51:14 +0000"  >&lt;p&gt;Hi, do you have any more information about this ?&lt;/p&gt;

&lt;p&gt;I&apos;m confused because the php documentation uses the Doctrine\XXX way, and everywhere I&apos;ve seen, it is used like that.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</comment>
                    <comment id="15718" author="k-fish" created="Mon, 11 Apr 2011 04:41:27 +0000"  >&lt;p&gt;The issue is simple and logical. &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;When an IDE (I am using PhpStorm and it does it like this) sees a namespace in a file, upon seeing namespaces afterwards, it sees them as absolute if they have a leading backslash, or relative when it does not. This affects the resolution of classes for type navigation, code inspection, ...  The same rules as for actual PHP code should be used within comments.&lt;/p&gt;

&lt;p&gt;Here is an example:&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;namespace Foo;

class Bar {

  /**
   * @&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; Baz
   */
  &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $baz;

  /**
   * @&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; \Quux
   */
  &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $quux;

}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The IDE will think $baz is \Foo\Baz and $quux will be seen as being \Quux. Now if you have some reference to Doctrine here, and it was relative, the IDE would assume it&apos;s \Foo\Doctrine\...&lt;/p&gt;</comment>
                    <comment id="15719" author="beberlei" created="Mon, 11 Apr 2011 04:57:42 +0000"  >&lt;p&gt;Well yes, but since all our code examples have no leading namespace argument this means the code is in the default namespace, making Doctrine\XXX\YY a relative namespace that is actually valid.&lt;/p&gt;</comment>
                    <comment id="15720" author="k-fish" created="Mon, 11 Apr 2011 05:46:52 +0000"  >&lt;p&gt;Yes, but the source code docblocks are what is meant here as far as I am concerned.&lt;/p&gt;</comment>
                    <comment id="15838" author="morfi" created="Fri, 13 May 2011 11:08:57 +0000"  >&lt;p&gt;Example (Entitymanager.php):&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;namespace Doctrine\ORM;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and&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;/**
  * The used Configuration.
  *
  * @&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; Doctrine\ORM\Configuration
  */
   &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $config;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Result:&lt;br/&gt;
&lt;b&gt;Doctrine\ORM\Doctrine\ORM\Configuration&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Should be:&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;/**
  * The used Configuration.
  *
  * @&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; Configuration
  */
   &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $config;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Or&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;/**
  * The used Configuration.
  *
  * @&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; \Doctrine\ORM\Configuration
  */
   &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $config;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="15887" author="mvrhov" created="Fri, 27 May 2011 09:36:15 +0000"  >&lt;p&gt;Why don&apos;t you take this to the PhpStorm tracker as it surely is a bug in IDE?&lt;/p&gt;</comment>
                    <comment id="15888" author="k-fish" created="Fri, 27 May 2011 12:43:39 +0000"  >&lt;p&gt;Miha, what makes you think it&apos;s an IDE bug? In a class in namespace Foo another class named Bar is \Foo\Bar, but \Bar is \Bar. Why is it a bug if the IDE follows the namespace resolution rules?&lt;/p&gt;
</comment>
                    <comment id="16146" author="mridgway" created="Mon, 11 Jul 2011 17:34:05 +0000"  >&lt;p&gt;The issue is that PHPStorm and NetBeans have different class resolution rules. I also use PHPStorm and most of Doctrine does not resolve auto-completion correctly because of this issue.&lt;/p&gt;

&lt;p&gt;I&apos;d be willing to work on this if it would be accepted.&lt;/p&gt;</comment>
                    <comment id="16535" author="andrewmackrodt" created="Thu, 29 Sep 2011 11:58:52 +0000"  >&lt;p&gt;I&apos;ve been evaluating PhpStorm and also came across this issue; I believe the problem is due to Doctrine rather than being a bug with the IDE although it would be nice if PhpStorm would assume namespaces are absolute if they&apos;re not resolved upon an initial lookup.&lt;/p&gt;

&lt;p&gt;I created a quick c# app to append the beginning forward slash to any @var or @return attributes within Doctrine&apos;s source. It&apos;s working for me with Doctrine 2.1.2 and PhpStorm (IntelliJ): &lt;a href=&quot;http://pastebin.com/4HxiWvJA&quot; class=&quot;external-link&quot;&gt;http://pastebin.com/4HxiWvJA&lt;/a&gt; - hopefully this will be of use for anyone else using these IDEs;. Note: the application doesn&apos;t detect multiple line annotations although the only one I&apos;m aware of is the getAST method in Doctrine\ORM\Query.php.&lt;/p&gt;</comment>
                    <comment id="16978" author="beberlei" created="Tue, 13 Dec 2011 20:41:09 +0000"  >&lt;p&gt;This issue is referenced in Github Pull-Request GH-215&lt;br/&gt;
&lt;a href=&quot;https://github.com/doctrine/doctrine2/pull/215&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/pull/215&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="16979" author="beberlei" created="Tue, 13 Dec 2011 20:41:16 +0000"  >&lt;p&gt;This issue is referenced in Github Pull-Request GH-216&lt;br/&gt;
&lt;a href=&quot;https://github.com/doctrine/doctrine2/pull/216&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/pull/216&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1016] Example code does not reflect real code</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1016</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/docs/orm/2.0/en/reference/working-with-objects.html#entity-state&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/docs/orm/2.0/en/reference/working-with-objects.html#entity-state&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the switch cases all the UnitOfWork constants are invalid.&lt;/p&gt;

&lt;p&gt;Example:&lt;br/&gt;
UnitOfWork::NEW instead of being UnitOfWork::STATE_NEW&lt;/p&gt;</description>
                <environment>Website</environment>
            <key id="12355">DDC-1016</key>
            <summary>Example code does not reflect real code</summary>
                <type id="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/documentation.png">Documentation</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="thoth">thoth</reporter>
                        <labels>
                    </labels>
                <created>Thu, 3 Feb 2011 17:10:50 +0000</created>
                <updated>Thu, 3 Feb 2011 17:10:50 +0000</updated>
                                    <version>2.0.1</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-999] DQL always needs a FROM clause, should be changed</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-999</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Sometimes a developer needs to issue a query without a FROM clause. This especially occurs using the QueryBuilder, when you may or may not have a table to select from, but call a stored procedure always.&lt;/p&gt;

&lt;p&gt;Example:&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;$query = $em&amp;gt;createQuery(&apos;SELECT (1+1)&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The above query fails because the lexer expects T_FROM. If you replace (1+1) with a stored procedure, this example makes more sense.&lt;/p&gt;

&lt;p&gt;One might argue about that you should use DBAL directly, but I disagree, because it always can happen that you end up in a situation like 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;$qb = $em-&amp;gt;createQueryBuilder();

$qb-&amp;gt;select(&lt;span class=&quot;code-quote&quot;&gt;&quot;SOMEFANCYPROCEDURE()&quot;&lt;/span&gt;);

&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($condition) {
  $qb = $qb-&amp;gt;from(&lt;span class=&quot;code-quote&quot;&gt;&quot;additionalTable t&quot;&lt;/span&gt;);
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="12319">DDC-999</key>
            <summary>DQL always needs a FROM clause, should be changed</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="felicitus">Timo A. Hummel</reporter>
                        <labels>
                    </labels>
                <created>Sun, 23 Jan 2011 20:25:54 +0000</created>
                <updated>Sun, 23 Jan 2011 20:26:34 +0000</updated>
                                    <version>2.0</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-952] Several features to batch eager selects more efficently</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-952</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;This ticket aggregates several strategies to optimize batching of eager selects.&lt;/p&gt;</description>
                <environment></environment>
            <key id="12257">DDC-952</key>
            <summary>Several features to batch eager selects more efficently</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="beberlei">Benjamin Eberlei</reporter>
                        <labels>
                    </labels>
                <created>Mon, 27 Dec 2010 18:14:21 +0000</created>
                <updated>Mon, 4 Jul 2011 21:47:46 +0000</updated>
                                                    <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="15074" author="beberlei" created="Fri, 31 Dec 2010 06:47:18 +0000"  >&lt;p&gt;Requirements for batching of eager loads:&lt;/p&gt;

&lt;p&gt;1. Since we are using an IN() query for this we can only support this feature for entities that have a single column primary key.&lt;br/&gt;
2. If we want to support composite keys we need to build it as WHERE ( (id1 = ? AND id2 = ?) OR (id1 = ? AND id2 = ?)) but this is currently not possible with the way how internally the $criteria array is used.&lt;/p&gt;</comment>
                    <comment id="15075" author="beberlei" created="Fri, 31 Dec 2010 07:38:56 +0000"  >&lt;p&gt;Next item to think about: What if an exception or event breaks the flow and &quot;triggerEagerLoads()&quot; is never called?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
            <subtask id="10197">DDC-53</subtask>
            <subtask id="11731">DDC-733</subtask>
            <subtask id="11736">DDC-734</subtask>
            <subtask id="12076">DDC-865</subtask>
            <subtask id="12249">DDC-914</subtask>
            <subtask id="12269">DDC-963</subtask>
            <subtask id="12453">DDC-1060</subtask>
        </subtasks>
        </item>

<item>
            <title>[DDC-1450] UnitOfWork Transaction Rollback Support</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1450</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;The UnitOfWork does not handle the case very well where a rollback is necessary. Can this be optimized?&lt;/p&gt;</description>
                <environment></environment>
            <key id="13122">DDC-1450</key>
            <summary>UnitOfWork Transaction Rollback Support</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="beberlei">Benjamin Eberlei</reporter>
                        <labels>
                    </labels>
                <created>Mon, 24 Oct 2011 07:51:09 +0000</created>
                <updated>Tue, 20 Dec 2011 22:21:37 +0000</updated>
                                                    <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="17073" author="guilhermeblanco" created="Tue, 20 Dec 2011 22:21:37 +0000"  >&lt;p&gt;Updating fix version&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1443] Subscribers reachs maximum nesting level when creating association on pre/postPersist with cascade persist</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1443</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Suppose a situation where:&lt;/p&gt;

&lt;p&gt;A -&amp;gt; B&lt;/p&gt;

&lt;p&gt;Where the OneToOne unidirectional association contains cascade persist.&lt;/p&gt;

&lt;p&gt;If I decide to save an entity B that should create an A instance, it goes into maximum nesting level no matter if I track prePersist or postPersist.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13108">DDC-1443</key>
            <summary>Subscribers reachs maximum nesting level when creating association on pre/postPersist with cascade persist</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="guilhermeblanco">Guilherme Blanco</reporter>
                        <labels>
                    </labels>
                <created>Thu, 20 Oct 2011 16:57:36 +0000</created>
                <updated>Sat, 29 Oct 2011 07:27:24 +0000</updated>
                                    <version>Git Master</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="16676" author="guilhermeblanco" created="Thu, 20 Oct 2011 18:54:45 +0000"  >&lt;p&gt;Failing test case&lt;/p&gt;</comment>
                    <comment id="16677" author="guilhermeblanco" created="Thu, 20 Oct 2011 20:10:08 +0000"  >&lt;p&gt;Uploading a new version, now passing successfully, but consuming the onFlush event (which should not be ideal).&lt;/p&gt;</comment>
                    <comment id="16720" author="beberlei" created="Sat, 29 Oct 2011 07:27:24 +0000"  >&lt;p&gt;Ah yes, this never worked. The transaction stuff will fix that. You have to use scheduleForInsert() something inside prePersist.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11080" name="DDC1443Test.php" size="3664" author="guilhermeblanco" created="Thu, 20 Oct 2011 20:10:08 +0000" />
                    <attachment id="11079" name="DDC1443Test.php" size="3383" author="guilhermeblanco" created="Thu, 20 Oct 2011 18:54:45 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1441] Metadata cannot be loaded for not registered proxy objects</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1441</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;We are using several Doctrine managers in our project with the same entity classes and different database tables.&lt;/p&gt;

&lt;p&gt;The problem appears when we are willing to merge entity with lazy associations from one manager to another. The second entity manager instance hasn&apos;t got the proxy object metadata defined yet so it fails with Doctrine\ORM\Mapping\MappingException exception &quot;Class EntityProxy is not a valid entity or mapped super class.&quot;.&lt;/p&gt;

&lt;p&gt;If both entity managers share the proxy objects the problem can be fixed by calling &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;$em-&amp;gt;getProxyFactory()-&amp;gt;getProxy(&apos;Entity&apos;, -1);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;which will register the entity metadata for the proxy classname as well.&lt;/p&gt;

&lt;p&gt;Still if the proxy configuration differs, there is no fix found without changing the Doctrine ORM code.&lt;/p&gt;

&lt;p&gt;The fix inside the Doctrine would be to detect Proxy classes before loading the metadata and load the metadata for it&apos;s parent class instead. Please see the diff attached with proposed solution.&lt;/p&gt;

&lt;p&gt;Also I think this issue could arise when unserialized entity objects will be merged into the entity manager. I will try creating test case for this.&lt;/p&gt;</description>
                <environment>MySQL, Ubuntu, PHP 5.3.6</environment>
            <key id="13106">DDC-1441</key>
            <summary>Metadata cannot be loaded for not registered proxy objects</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="gedrox">Aigars Gedroics</reporter>
                        <labels>
                    </labels>
                <created>Thu, 20 Oct 2011 13:02:43 +0000</created>
                <updated>Thu, 5 Apr 2012 08:39:55 +0000</updated>
                                    <version>2.1.2</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="16913" author="gedrox" created="Thu, 24 Nov 2011 14:45:46 +0000"  >&lt;p&gt;Test case attached.&lt;/p&gt;</comment>
                    <comment id="17768" author="gedrox" created="Thu, 5 Apr 2012 08:39:55 +0000"  >&lt;p&gt;See my pull request in &lt;a href=&quot;https://github.com/doctrine/doctrine2/pull/332&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/pull/332&lt;/a&gt;.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11116" name="DDC1441Test.php" size="2539" author="gedrox" created="Thu, 24 Nov 2011 14:45:46 +0000" />
                    <attachment id="11077" name="not-loaded-proxy-patch.diff" size="1096" author="gedrox" created="Thu, 20 Oct 2011 13:02:43 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1429] Add a method to the unit of work that merges any detached entity into UoW without calling SQL</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1429</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;This is for those that know what they are doing &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/wink.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</description>
                <environment></environment>
            <key id="13094">DDC-1429</key>
            <summary>Add a method to the unit of work that merges any detached entity into UoW without calling SQL</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="beberlei">Benjamin Eberlei</reporter>
                        <labels>
                    </labels>
                <created>Mon, 17 Oct 2011 22:05:01 +0000</created>
                <updated>Mon, 17 Oct 2011 22:05:01 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1398] loading one item at a time when indexBy and EXTRA_LAZY fetch mode is used on a collection</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1398</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;collection-&amp;gt;get($key)&lt;/p&gt;

&lt;p&gt;Atm in 2.1.2 this is loading the entire collection. It would be really handy that it would extra lazy load only one item using the association and indexBy fields and given key value (if collection is not initialized and the key havent been loaded yet ofc)&lt;/p&gt;

&lt;p&gt;Am i making sense with this? &lt;/p&gt;</description>
                <environment></environment>
            <key id="13053">DDC-1398</key>
            <summary>loading one item at a time when indexBy and EXTRA_LAZY fetch mode is used on a collection</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="hypno">Reio Piller</reporter>
                        <labels>
                    </labels>
                <created>Thu, 29 Sep 2011 18:34:38 +0000</created>
                <updated>Sat, 10 Mar 2012 16:30:19 +0000</updated>
                                                    <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>3</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="17075" author="guilhermeblanco" created="Tue, 20 Dec 2011 22:22:20 +0000"  >&lt;p&gt;Updating fix version&lt;/p&gt;</comment>
                    <comment id="17526" author="gcaseres" created="Mon, 5 Mar 2012 22:02:25 +0000"  >&lt;p&gt;Is there any fix for this? i have the same problem.&lt;/p&gt;</comment>
                    <comment id="17544" author="deatheriam" created="Sat, 10 Mar 2012 16:29:38 +0000"  >&lt;p&gt;It makes a perfect sense here, I wish it was possible, it would give us a room for even more optimization. Any input on the issue from the developers?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1390]  Lazy loading does not work for the relationships of an entity instance, whose class inherits from another entity class</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1390</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Lazy loading does not work for the relationships of an instance of an entity, whose class inherits from another entity class.&lt;/p&gt;

&lt;p&gt;Assume there are two entity classes, A and B, where A inherits from B.&lt;/p&gt;

&lt;p&gt;Now let $a be an instance of A, e. g. the result of &quot;SELECT a FROM \A WHERE a.id = 1&quot;.&lt;/p&gt;

&lt;p&gt;Outputting $a will confirm it is a valid instance of a proxy object inheriting from A.&lt;/p&gt;

&lt;p&gt;Assume that the database row corresponding to $a contains a non-null foreign key that actually links to an existing row in another table, corresponding to another entity instance of a different class.&lt;/p&gt;

&lt;p&gt;Now, $a-&amp;gt;someRelationship will always returns null in this scenario. I assume this is unintended behaviour, because clearly, the other entity should be lazily loaded on accessing it, and there is a value in the database.&lt;/p&gt;

&lt;p&gt;The fetch annotation attribute on that relationship has not been explicitly set, so I assume it is set to the default value, which, according to the docs, should be &quot;lazy&quot;.&lt;/p&gt;

&lt;p&gt;The loading only fails when accessing the relationships of an entity instance, whose class inherits from another entity class. For entity instances, whose classes do not inherit from another entity class, lazy loading of their relationships works as expected.&lt;/p&gt;

&lt;p&gt;I had a look at the proxy objects and verified that they are present and override the __get method with an implementation containing a call to the load() method. Still, the loading won&apos;t work for some reason.&lt;/p&gt;

&lt;p&gt;This could be related to Bug &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-1389&quot; title=&quot;Querying subclass entities using DQL results in broken SQL being generated&quot;&gt;&lt;del&gt;DDC-1389&lt;/del&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-1389&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DDC-1389&lt;/a&gt;) which also happens exclusively in an inheritance scenario. Maybe the current implementation of inheritance is generally wrong or incomplete.&lt;/p&gt;</description>
                <environment>Debian Linux 6.0, MySQL 5.0.51a</environment>
            <key id="13036">DDC-1390</key>
            <summary> Lazy loading does not work for the relationships of an entity instance, whose class inherits from another entity class</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/inprogress.png">In Progress</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="dalvarez">Daniel Alvarez Arribas</reporter>
                        <labels>
                    </labels>
                <created>Thu, 22 Sep 2011 17:22:51 +0000</created>
                <updated>Sun, 6 Jan 2013 08:59:31 +0000</updated>
                                    <version>2.1.1</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="16760" author="beberlei" created="Mon, 31 Oct 2011 22:31:10 +0000"  >&lt;p&gt;Did this get fixed with the correction of your data?&lt;/p&gt;</comment>
                    <comment id="16762" author="dalvarez" created="Tue, 1 Nov 2011 06:22:55 +0000"  >&lt;p&gt;No it did not. This issue is completely unrelated to the other one.&lt;/p&gt;

&lt;p&gt;For this, I have manually implemented workarounds, fetching the associations using DQL queries. Lazy loading in the inheritance scenario above still would not work.&lt;/p&gt;</comment>
                    <comment id="16763" author="beberlei" created="Tue, 1 Nov 2011 11:22:56 +0000"  >&lt;p&gt;So A is an entity in a hierachy A -&amp;gt; B, and &quot;someRelationship&quot; is a field on A or on B &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/help_16.gif&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; towards an Entity C that is in an inheritance hierachy or not? &lt;/p&gt;

&lt;p&gt;Could you post parts of the mappings (entity docblock and the relationship)?&lt;/p&gt;</comment>
                    <comment id="16772" author="dalvarez" created="Sun, 6 Nov 2011 17:05:25 +0000"  >&lt;p&gt;Hey, thanks for taking care of this.&lt;/p&gt;

&lt;p&gt;I attached the entities involved in the szenario to this issue.&lt;/p&gt;

&lt;p&gt;I had problems lazy loading entities through the following associations:&lt;/p&gt;

&lt;p&gt;  Run.invoiceCreatorResult&lt;br/&gt;
  Run.commissionNoteCreatorResult&lt;br/&gt;
  Run.consumerInvoiceExporterResult&lt;/p&gt;

&lt;p&gt;as well as&lt;/p&gt;

&lt;p&gt;  InvoiceCreatorResult.dataVersion&lt;br/&gt;
  CommissionNoteCreatorResult.dataVersion&lt;br/&gt;
  ConsumerInvoiceExporterResult.dataVersion&lt;/p&gt;


&lt;p&gt;In this scenario, InvoiceCreatorResult, CommissionNoteCreatorResult and ConsumerInvoiceExporterResult all inherit from Result, which in turn inherits from a mapped superclass DataObject. Run and DataVersion inherit from DataObject directly.&lt;/p&gt;

&lt;p&gt;The associations where lazy loading does not work are associations both to and from the entity classes InvoiceCreatorResult, CommissionNoteCreatorResult and ConsumerInvoiceExporterResult.&lt;/p&gt;</comment>
                    <comment id="16859" author="beberlei" created="Fri, 18 Nov 2011 13:52:28 +0000"  >&lt;blockquote&gt;
&lt;p&gt;Now let $a be an instance of A, e. g. the result of &quot;SELECT a FROM \A WHERE a.id = 1&quot;.&lt;/p&gt;

&lt;p&gt;Outputting $a will confirm it is a valid instance of a proxy object inheriting from A.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Just a short Q on understanding: Why is $a a proxy of A if you select it explicitly?&lt;/p&gt;</comment>
                    <comment id="16861" author="beberlei" created="Fri, 18 Nov 2011 14:21:35 +0000"  >&lt;p&gt;This a working test-case with a model that i believe resembles yours exactly.&lt;/p&gt;

&lt;p&gt;I also put your models into another test and ran schema validation on them, which works out without problems.&lt;/p&gt;

&lt;p&gt;From the workflow with proxies, maybe &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-1452&quot; title=&quot;ObjectHydrator bug: hydration of entity with self (cyclic) relation through ref entity&quot;&gt;&lt;del&gt;DDC-1452&lt;/del&gt;&lt;/a&gt; might be related to your issue?&lt;/p&gt;</comment>
                    <comment id="16871" author="dalvarez" created="Fri, 18 Nov 2011 17:47:53 +0000"  >&lt;p&gt;Regarding the proxy question, I just ment the query to be an example to further illustrate the type of $a. It was redundant and unnecessary though and probably misleading. Sorry for that. I did not select anything in the actual scenario. $a is merely some object of type A. No queries are involved.&lt;/p&gt;</comment>
                    <comment id="16873" author="dalvarez" created="Fri, 18 Nov 2011 18:16:24 +0000"  >&lt;p&gt;Have you been able to make the tests fail with the original data provided?&lt;/p&gt;

&lt;p&gt;If not, I could set up a test case and post it.&lt;/p&gt;</comment>
                    <comment id="16874" author="beberlei" created="Fri, 18 Nov 2011 18:38:02 +0000"  >&lt;p&gt;No i only checked the validity of mappings with the original data. If you could setup a testcase that would be really great.&lt;/p&gt;</comment>
                    <comment id="16890" author="dalvarez" created="Sat, 19 Nov 2011 16:05:52 +0000"  >&lt;p&gt;I will set up a test case and upload it. I&apos;ll see if I can do it one of the next evenings.&lt;/p&gt;</comment>
                    <comment id="17011" author="beberlei" created="Sat, 17 Dec 2011 13:26:19 +0000"  >&lt;p&gt;I tried again, also extended &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-1390&quot; title=&quot; Lazy loading does not work for the relationships of an entity instance, whose class inherits from another entity class&quot;&gt;DDC-1390&lt;/a&gt;, but it was impossible for me to reproduce this. I ran this against master, 2.1.x and 2.1.1 specifically.&lt;/p&gt;</comment>
                    <comment id="19217" author="dalvarez" created="Sat, 5 Jan 2013 18:42:17 +0000"  >&lt;p&gt;Sorry, I got swamped with work. Now I am working on this dedicatedly, testing against the latest release. Will let you know once I have a testcase.&lt;/p&gt;</comment>
                    <comment id="19218" author="beberlei" created="Sun, 6 Jan 2013 08:59:31 +0000"  >&lt;p&gt;Good to hear, thanks for the persistent work on this.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11100" name="CommissionNoteCreatorResult.php" size="891" author="dalvarez" created="Sun, 6 Nov 2011 16:56:50 +0000" />
                    <attachment id="11101" name="ConsumerInvoiceExporterResult.php" size="353" author="dalvarez" created="Sun, 6 Nov 2011 16:56:50 +0000" />
                    <attachment id="11096" name="DataObject.php" size="1338" author="dalvarez" created="Sun, 6 Nov 2011 16:54:35 +0000" />
                    <attachment id="11102" name="DataVersion.php" size="1314" author="dalvarez" created="Sun, 6 Nov 2011 16:58:35 +0000" />
                    <attachment id="11112" name="DDC1390Test.php" size="2412" author="beberlei" created="Fri, 18 Nov 2011 14:21:35 +0000" />
                    <attachment id="11099" name="InvoiceCreatorResult.php" size="835" author="dalvarez" created="Sun, 6 Nov 2011 16:55:13 +0000" />
                    <attachment id="11098" name="Result.php" size="1669" author="dalvarez" created="Sun, 6 Nov 2011 16:54:35 +0000" />
                    <attachment id="11097" name="Run.php" size="1817" author="dalvarez" created="Sun, 6 Nov 2011 16:54:35 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1380] Standardize proxy class naming</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1380</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;see &lt;a href=&quot;https://github.com/doctrine/doctrine2/pull/125&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/pull/125&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
            <key id="13024">DDC-1380</key>
            <summary>Standardize proxy class naming</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="johannes">Johannes Schmitt</reporter>
                        <labels>
                    </labels>
                <created>Sun, 18 Sep 2011 11:14:10 +0000</created>
                <updated>Sun, 18 Sep 2011 11:14:10 +0000</updated>
                                    <version>2.x</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1357] Queries with multiple joins resulting in multiple scalar results for each top level entity only retain one scalar value for each entity</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1357</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Consider this example:&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;select g.id, u.id, u.status, count(p.phonenumber) numPhones from Group
     * g join g.user u join u.phonenumbers p group by g.id, u.status, u.id&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;With data:&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;phonenumbers:
    [1, 2, 3, 4, 5, 6]
users:
    [{id: 1, status: developer, phonenumbers: [1, 2]},
     {id: 2, status: developer, phonenumbers: [3]},
     {id: 3, status: developer, phonenumbers: [4, 5, 6]}]
groups:
    [{id: 1, users: [1, 2]]},
     {id:2, users: [3]}]
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The result currently is:&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;array(
    array(
        0 =&amp;gt; object(CmsGroup) {
            &apos;id&apos; =&amp;gt; 1,
            &apos;users&apos; =&amp;gt; Collection(
                object(CmsUser) { &apos;id&apos; =&amp;gt; 1 },
                object(CmsUser) { &apos;id&apos; =&amp;gt; 2 }
            )
         },
        &apos;numPhones&apos; =&amp;gt; 1
    ),
    array(
        0 =&amp;gt; object(CmsGroup) {
            &apos;id&apos; =&amp;gt; 2,
            &apos;users&apos; =&amp;gt; Collection(
                object(CmsUser) { &apos;id&apos; =&amp;gt; 3 }
            )
        },
        &apos;numPhones&apos; =&amp;gt; 3
    )
)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Note that the first entry contains only one value numPhones =&amp;gt; 1, even though there are two users associated with that group. One of whom has 2 phone numbers and the other has 1.&lt;/p&gt;

&lt;p&gt;The result I would expect is:&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;array(
    array(
        0 =&amp;gt; object(CmsGroup) {
            &apos;id&apos; =&amp;gt; 1,
            &apos;users&apos; =&amp;gt; Collection(
                object(CmsUser) { &apos;id&apos; =&amp;gt; 1 },
                object(CmsUser) { &apos;id&apos; =&amp;gt; 2 }
            )
         },
        &apos;numPhones&apos; =&amp;gt; array(2, 1)
    ),
    array(
        0 =&amp;gt; object(CmsGroup) {
            &apos;id&apos; =&amp;gt; 2,
            &apos;users&apos; =&amp;gt; Collection(
                object(CmsUser) { &apos;id&apos; =&amp;gt; 3 }
            )
        },
        &apos;numPhones&apos; =&amp;gt; array(3)
    )
)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The difference is that numPhones for each row now contains an array of the&lt;br/&gt;
scalar values matching the corresponding users.&lt;/p&gt;</description>
                <environment></environment>
            <key id="12991">DDC-1357</key>
            <summary>Queries with multiple joins resulting in multiple scalar results for each top level entity only retain one scalar value for each entity</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="naderman">Nils Adermann</reporter>
                        <labels>
                    </labels>
                <created>Thu, 1 Sep 2011 22:46:17 +0000</created>
                <updated>Thu, 1 Sep 2011 22:50:05 +0000</updated>
                                    <version>Git Master</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="16410" author="naderman" created="Thu, 1 Sep 2011 22:49:22 +0000"  >&lt;p&gt;You can find a test case for the correct result here: &lt;a href=&quot;https://github.com/naderman/doctrine2/commit/a1ca3d9847cbc514fc951fb0b221b26fe03a6619&quot; class=&quot;external-link&quot;&gt;https://github.com/naderman/doctrine2/commit/a1ca3d9847cbc514fc951fb0b221b26fe03a6619&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1320] Ship Immutable date time with Doctrine Common, use in ORM - Should implement __toString()</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1320</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description></description>
                <environment></environment>
            <key id="12904">DDC-1320</key>
            <summary>Ship Immutable date time with Doctrine Common, use in ORM - Should implement __toString()</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="beberlei">Benjamin Eberlei</reporter>
                        <labels>
                    </labels>
                <created>Sat, 6 Aug 2011 17:05:04 +0000</created>
                <updated>Mon, 31 Oct 2011 19:16:21 +0000</updated>
                                                    <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="16745" author="beberlei" created="Mon, 31 Oct 2011 19:16:21 +0000"  >&lt;p&gt;Has to be pushed back as immutable date time cannot be implemented in userland that well.&lt;/p&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10002">
                <name>Dependency</name>
                                <outwardlinks description="depends on">
                            <issuelink>
            <issuekey id="12896">DDC-1316</issuekey>
        </issuelink>
                    </outwardlinks>
                                            </issuelinktype>
                    </issuelinks>
                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2104] BasicEntityPersister::load() doesn&apos;t allow for cache usage</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2104</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;BasicEntityPersister::load() calls:&lt;br/&gt;
$stmt = $this-&amp;gt;_conn-&amp;gt;executeQuery($sql, $params, $types);&lt;br/&gt;
on line 665 of master/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php&lt;/p&gt;

&lt;p&gt;The executeQuery function has an optional fourth parameter to pass a QueryCacheProfile variable to use caching on the query.  This is ignored/not implemented by BasicEntityPersister::load()&lt;/p&gt;</description>
                <environment>This is a new feature,  not a bug</environment>
            <key id="14169">DDC-2104</key>
            <summary>BasicEntityPersister::load() doesn&apos;t allow for cache usage</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="dmcfaul">Dan McFaul</reporter>
                        <labels>
                    </labels>
                <created>Thu, 25 Oct 2012 19:43:26 +0000</created>
                <updated>Mon, 12 Nov 2012 14:51:07 +0000</updated>
                                    <version>Git Master</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>2</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2100] Getting Started: Code First PHP fatal error:Call to undefined method Bug::setDescription()</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2100</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;&lt;a href=&quot;http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/getting-started.html&quot; class=&quot;external-link&quot;&gt;http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/getting-started.html&lt;/a&gt;&lt;br/&gt;
in file create_bug.php&lt;br/&gt;
$bug-&amp;gt;setDescription(&quot;Something does not work!&quot;);&lt;br/&gt;
but the class Bug do not have setDescription function.&lt;/p&gt;

&lt;p&gt;ps:&lt;br/&gt;
try find &quot;setDescription&quot; on that page. there is only one .&lt;/p&gt;</description>
                <environment>ubuntu 1204 php5.3.8</environment>
            <key id="14164">DDC-2100</key>
            <summary>Getting Started: Code First PHP fatal error:Call to undefined method Bug::setDescription()</summary>
                <type id="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/documentation.png">Documentation</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>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="bronze1man">bronze1man</reporter>
                        <labels>
                    </labels>
                <created>Wed, 24 Oct 2012 14:28:15 +0000</created>
                <updated>Wed, 24 Oct 2012 14:30:06 +0000</updated>
                                    <version>2.3</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2093] Doctrine Criteria does not support sorting by relationed field</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2093</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&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-none&quot;&gt;
// Here I call Criteria filter
public function getWalletsActive() {
	$criteria = Criteria::create()
		-&amp;gt;where(Criteria::expr()-&amp;gt;eq(&quot;isRemoved&quot;, &quot;0&quot;))
		-&amp;gt;orderBy(array(&quot;currency.id&quot; =&amp;gt; &quot;ASC&quot;));
	return $this-&amp;gt;wallets-&amp;gt;matching($criteria);
}

// Relation
/**
 * @var Currency
 *
 * @ORM\ManyToOne(targetEntity=&quot;Currency&quot;)
 * @ORM\JoinColumns({
 * @ORM\JoinColumn(name=&quot;id_currency&quot;, referencedColumnName=&quot;id&quot;)
 * })
 */
protected $currency;

// File BasicEntityPersister.php
// This cause the problem:
if ( ! isset($this-&amp;gt;_class-&amp;gt;fieldMappings[$fieldName])) {
    throw ORMException::unrecognizedField($fieldName);
}
// There are no relations in $this-&amp;gt;_class-&amp;gt;fieldMappings at all!
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="14150">DDC-2093</key>
            <summary>Doctrine Criteria does not support sorting by relationed field</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="nick4fake">Bogdan Yurov</reporter>
                        <labels>
                    </labels>
                <created>Sat, 20 Oct 2012 09:10:02 +0000</created>
                <updated>Sun, 6 Jan 2013 18:29:28 +0000</updated>
                                    <version>Git Master</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="19237" author="beberlei" created="Sun, 6 Jan 2013 18:29:28 +0000"  >&lt;p&gt;Mark as improvement.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2089] Modify OneToMany to allow unidirectional associations without the need of a JoinTable</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2089</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;As I sayd in the title, it would be nice if the ORM layer could permit to map a 1:n association in the db as an unidirectional OneToMany in the classes, without using a JoinTable in the database.&lt;br/&gt;
This would permit us to get rid of the unnecessary database JoinTable, which creates disorder and decreases performance for no valuable reason.&lt;/p&gt;

&lt;p&gt;Is it possible?&lt;/p&gt;</description>
                <environment>Debian Wheezy, Mysql 5.1, Apache2, PHP 5.4</environment>
            <key id="14145">DDC-2089</key>
            <summary>Modify OneToMany to allow unidirectional associations without the need of a JoinTable</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="noise085">Enea Bette</reporter>
                        <labels>
                        <label>onetomany</label>
                        <label>persister</label>
                        <label>unidirectional</label>
                    </labels>
                <created>Fri, 19 Oct 2012 10:11:55 +0000</created>
                <updated>Sun, 16 Dec 2012 17:42:11 +0000</updated>
                                    <version>2.x</version>
                                <fixVersion>2.4</fixVersion>
                <fixVersion>3.0</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="19150" author="noise085" created="Sun, 16 Dec 2012 17:42:11 +0000"  >&lt;p&gt;A little up... for inspiration from JPA &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://en.wikibooks.org/wiki/Java_Persistence/OneToMany#Undirectional_OneToMany.2C_No_Inverse_ManyToOne.2C_No_Join_Table_.28JPA_2.0_ONLY.29&quot; class=&quot;external-link&quot;&gt;http://en.wikibooks.org/wiki/Java_Persistence/OneToMany#Undirectional_OneToMany.2C_No_Inverse_ManyToOne.2C_No_Join_Table_.28JPA_2.0_ONLY.29&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2042] Metadata association overriding : allow to override &apos;targetEntity&apos;</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2042</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;While associating object to an descriminated table I wasn&apos;t enable to fix the entityTarget (only one can be set in entity annotation).&lt;/p&gt;

&lt;p&gt;It could be resolve by adding the possibility to override &apos;targetEntity&apos; value in Doctrine\ORM\Mapping\ClassMetadataInfo::ClassMetadataInfo().&lt;/p&gt;

&lt;p&gt;Such as :&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;if (isset($overrideMapping&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;targetEntity&amp;#39;&amp;#93;&lt;/span&gt;)) {&lt;br/&gt;
    $mapping&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;targetEntity&amp;#39;&amp;#93;&lt;/span&gt; = $overrideMapping&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;targetEntity&amp;#39;&amp;#93;&lt;/span&gt;;&lt;br/&gt;
}&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;That would need to add a control on the new targetEntity in Doctrine\ORM\Mapping\ClassMetadataInfo::_validateAndCompleteAssociationMapping().&lt;/p&gt;

&lt;p&gt;Such as :&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;if ( ! ClassLoader::classExists($mapping&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;targetEntity&amp;#39;&amp;#93;&lt;/span&gt;) ) {&lt;br/&gt;
throw MappingException::invalidTargetEntityClass($mapping&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;targetEntity&amp;#39;&amp;#93;&lt;/span&gt;, $this-&amp;gt;name, $mapping&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;fieldName&amp;#39;&amp;#93;&lt;/span&gt;);&lt;br/&gt;
}&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;cro.&lt;/p&gt;</description>
                <environment></environment>
            <key id="14067">DDC-2042</key>
            <summary>Metadata association overriding : allow to override &apos;targetEntity&apos;</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="cro">Charles Rouillon</reporter>
                        <labels>
                    </labels>
                <created>Wed, 26 Sep 2012 08:57:40 +0000</created>
                <updated>Wed, 26 Sep 2012 08:59:38 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2043] Extra cache operation in DBAL\Cache\ResultCacheStatement.php</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2043</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;This is the closeCursor() method in DBAL\Cache\ResultCacheStatement.php:&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;
&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function closeCursor()
    {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;statement-&amp;gt;closeCursor();
        &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;emptied &amp;amp;&amp;amp; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;data !== &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;) {
            $data = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;resultCache-&amp;gt;fetch($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;cacheKey);
            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ( ! $data) {
                $data = array();
            }
            $data[$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;realKey] = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;data;

            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;resultCache-&amp;gt;save($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;cacheKey, $data, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;lifetime);
            unset($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;data);
        }
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We are using Memcache and I noticed an extra GET operation on all cache misses. In the code above I believe the fetch call is not necessary and that the code would do the same without it. &lt;br/&gt;
Also, may I ask why is the SQL used as a key in the cached data?&lt;/p&gt;</description>
                <environment>CentOS, PHP 5.3.10</environment>
            <key id="14069">DDC-2043</key>
            <summary>Extra cache operation in DBAL\Cache\ResultCacheStatement.php</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="bogdan.albei">Bogdan Albei</reporter>
                        <labels>
                    </labels>
                <created>Wed, 26 Sep 2012 11:59:59 +0000</created>
                <updated>Wed, 26 Sep 2012 14:18:04 +0000</updated>
                                    <version>2.3</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="18733" author="stof" created="Wed, 26 Sep 2012 14:12:15 +0000"  >&lt;p&gt;The SQL is used as a key because it is what identifies the query which is done (well, the statement and the parameters)&lt;/p&gt;</comment>
                    <comment id="18734" author="bogdan.albei" created="Wed, 26 Sep 2012 14:18:04 +0000"  >&lt;p&gt;The cacheKey already identifies the query(or at least it should). Would we have cases where different queries would want to use the same cache key?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1991] Add parameter indexBy to EntityRepository-&gt;createQueryBuilder()</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1991</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;createQueryBuilder() currently doesn&#8217;t have a parameter to set the third option on the FROM fragment: indexBy. Right now you have to read it, create a new From with the read properties and your desired indexBy value and replace the existing one on the QueryBuilder.&lt;/p&gt;

&lt;p&gt;Should be ten minutes&#8217; work including tests. Thanks a lot!&lt;/p&gt;</description>
                <environment></environment>
            <key id="13977">DDC-1991</key>
            <summary>Add parameter indexBy to EntityRepository-&gt;createQueryBuilder()</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="corphi">Philipp Cordes</reporter>
                        <labels>
                    </labels>
                <created>Mon, 20 Aug 2012 07:52:31 +0000</created>
                <updated>Mon, 20 Aug 2012 07:52:31 +0000</updated>
                                    <version>Git Master</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1986] findBy hydration with limit and offset with Oracle database (oci8 driver)</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1986</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I tried to use the findBy method with limit and offset parameters against an Oracle database using oci8 driver.&lt;/p&gt;

&lt;p&gt;The query seems to executed successfully but the hydrator fails when hydrating data as there is a DOCTRINE_ROWNUM column appending the &quot;limit&quot; clause.&lt;/p&gt;

&lt;p&gt;Here is the exception thrown :  &quot;Notice: Undefined index: DOCTRINE_ROWNUM in &lt;span class=&quot;error&quot;&gt;&amp;#91;...&amp;#93;&lt;/span&gt;/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php line 183&quot;&lt;/p&gt;

&lt;p&gt;I was thinking about something like this to fix this issue &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/help_16.gif&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;add an attribute (platformExtraColumns) to the platform class, storing every column added by methods like doModifyLimitQuery&lt;/li&gt;
	&lt;li&gt;check in hydrator method hydrateRowData if the column exists among the extra columns attribute of the custom platform&lt;/li&gt;
	&lt;li&gt;don&apos;t use the column if true&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Maybe there is a better approach, what are your thoughts?&lt;/p&gt;</description>
                <environment>composer.json require :&lt;br/&gt;
&lt;br/&gt;
&amp;quot;php&amp;quot;: &amp;quot;&amp;gt;=5.3.3&amp;quot;,&lt;br/&gt;
&amp;quot;symfony/symfony&amp;quot;: &amp;quot;2.1.*&amp;quot;,&lt;br/&gt;
&amp;quot;doctrine/orm&amp;quot;: &amp;quot;&amp;gt;=2.2.3,&amp;lt;2.4-dev&amp;quot;,&lt;br/&gt;
&amp;quot;doctrine/doctrine-bundle&amp;quot;: &amp;quot;dev-master&amp;quot;,&lt;br/&gt;
&amp;quot;twig/extensions&amp;quot;: &amp;quot;dev-master&amp;quot;,&lt;br/&gt;
&amp;quot;symfony/assetic-bundle&amp;quot;: &amp;quot;dev-master&amp;quot;,&lt;br/&gt;
&amp;quot;symfony/swiftmailer-bundle&amp;quot;: &amp;quot;dev-master&amp;quot;,&lt;br/&gt;
&amp;quot;symfony/monolog-bundle&amp;quot;: &amp;quot;dev-master&amp;quot;,&lt;br/&gt;
&amp;quot;sensio/distribution-bundle&amp;quot;: &amp;quot;dev-master&amp;quot;,&lt;br/&gt;
&amp;quot;sensio/framework-extra-bundle&amp;quot;: &amp;quot;dev-master&amp;quot;,&lt;br/&gt;
&amp;quot;sensio/generator-bundle&amp;quot;: &amp;quot;dev-master&amp;quot;,&lt;br/&gt;
&amp;quot;jms/security-extra-bundle&amp;quot;: &amp;quot;1.2.*&amp;quot;,&lt;br/&gt;
&amp;quot;jms/di-extra-bundle&amp;quot;: &amp;quot;1.1.*&amp;quot;,&lt;br/&gt;
&amp;quot;twitter/bootstrap&amp;quot;: &amp;quot;master&amp;quot;,&lt;br/&gt;
&amp;quot;friendsofsymfony/rest-bundle&amp;quot;: &amp;quot;dev-master&amp;quot;,&lt;br/&gt;
&amp;quot;doctrine/doctrine-fixtures-bundle&amp;quot;: &amp;quot;dev-master&amp;quot;</environment>
            <key id="13970">DDC-1986</key>
            <summary>findBy hydration with limit and offset with Oracle database (oci8 driver)</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="10000" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/needinfo.png">Awaiting Feedback</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="benja-m-1">Benjamin Grandfond</reporter>
                        <labels>
                        <label>oracle</label>
                    </labels>
                <created>Fri, 17 Aug 2012 09:57:38 +0000</created>
                <updated>Tue, 8 Jan 2013 09:33:00 +0000</updated>
                                    <version>2.3</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>4</watches>
                        <comments>
                    <comment id="18524" author="benja-m-1" created="Fri, 17 Aug 2012 10:36:35 +0000"  >&lt;p&gt;I implemented it in my forks :&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/benja-M-1/doctrine2/commit/c8d899b14446accf869ddc0043f4235284375755&quot; class=&quot;external-link&quot;&gt;https://github.com/benja-M-1/doctrine2/commit/c8d899b14446accf869ddc0043f4235284375755&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;https://github.com/benja-M-1/dbal/commit/b9423c8d46a2bcdaa5a1f0b26a9a28259b1e44a2&quot; class=&quot;external-link&quot;&gt;https://github.com/benja-M-1/dbal/commit/b9423c8d46a2bcdaa5a1f0b26a9a28259b1e44a2&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It works for me, but I didn&apos;t write unit tests.&lt;/p&gt;</comment>
                    <comment id="18537" author="benja-m-1" created="Fri, 24 Aug 2012 13:12:43 +0000"  >&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;Did you have time to have a look at this issue?&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</comment>
                    <comment id="18538" author="stof" created="Fri, 24 Aug 2012 13:33:52 +0000"  >&lt;p&gt;Please send a pull request when you submit a fix. It is the proper way to submit them for review. When we want to see things waiting for review, we look at the list of pending PRs, not at all comments of the issue tracker to find links in them.&lt;/p&gt;

&lt;p&gt;And I can tell you that this change has a big issue: it introduces a state in the database platform whereas it is currently stateless. This is likely to cause some issues when using more than 1 query (which is a common use case).&lt;/p&gt;</comment>
                    <comment id="18555" author="benja-m-1" created="Wed, 29 Aug 2012 07:38:06 +0000"  >&lt;p&gt;Hi Christophe thank you for your feedback.&lt;/p&gt;

&lt;p&gt;I didn&apos;t send a PR because I wanted someone sharing his thoughts about what I suggested in this current issue. However I don&apos;t really understand the stateless argument, can you explain a bit more?&lt;/p&gt;

&lt;p&gt;Otherwise how would do you proceed to tell Doctrine not to hydrate platform-specific columns?&lt;/p&gt;
</comment>
                    <comment id="18556" author="stof" created="Wed, 29 Aug 2012 08:17:48 +0000"  >&lt;p&gt;If you run several queries, they will be affected by the extra columns of previous requests, which is wrong&lt;/p&gt;</comment>
                    <comment id="18557" author="beberlei" created="Wed, 29 Aug 2012 08:22:43 +0000"  >&lt;p&gt;I think the ObjectHydrator catches this by skipping undefined columns, i think we might just have overoptimized the SimpleObjectHydrator a little bit.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1965] Multiple Index fails if index name not specified</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1965</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;@ORM\Table(name=&quot;applications&quot;, indexes={@ORM\Index(name=&quot;csl_idx&quot;, columns=&lt;/p&gt;
{&quot;createdAt&quot;, &quot;status&quot;, &quot;loanType&quot;}), @ORM\Index(name=&quot;s_idx&quot;, columns={&quot;status&quot;}), @ORM\Index(name=&quot;l_idx&quot;, columns={&quot;loanType&quot;})})&lt;br/&gt;
&lt;br/&gt;
the above Annotation creates 3 different indexes BUT when: &lt;br/&gt;
* @ORM\Table(name=&quot;applications&quot;, indexes={@ORM\Index(columns={&quot;createdAt&quot;, &quot;status&quot;, &quot;loanType&quot;}
&lt;p&gt;), @ORM\Index(columns=&lt;/p&gt;
{&quot;status&quot;}
&lt;p&gt;), @ORM\Index(columns=&lt;/p&gt;
{&quot;loanType&quot;}
&lt;p&gt;)})&lt;/p&gt;

&lt;p&gt;index-names not specified Symfony2 schemaUpdate tools shows only the last Index&lt;/p&gt;
</description>
                <environment>Ubuntu 11.04, PHP 5.3.6 with Suhosin-patch, Symfony 2.0.15</environment>
            <key id="13906">DDC-1965</key>
            <summary>Multiple Index fails if index name not specified</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="pont">Pont</reporter>
                        <labels>
                        <label>Cli</label>
                    </labels>
                <created>Thu, 2 Aug 2012 07:17:04 +0000</created>
                <updated>Thu, 2 Aug 2012 07:17:04 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1963] Remove by-ref access to changeset in lifecycle event args</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1963</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;UoW currently passes computed changesets to lifecycle event args byref. This has to be changed to force users to use UoW public API to modify changesets instead.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13903">DDC-1963</key>
            <summary>Remove by-ref access to changeset in lifecycle event args</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="ocramius">Marco Pivetta</assignee>
                                <reporter username="ocramius">Marco Pivetta</reporter>
                        <labels>
                    </labels>
                <created>Tue, 31 Jul 2012 15:45:24 +0000</created>
                <updated>Tue, 31 Jul 2012 15:45:24 +0000</updated>
                                                    <fixVersion>Git Master</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1960] mapping joins in native queries breaks if select columns are starting with columns from joined table</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1960</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Using a simple Testcase like in &lt;a href=&quot;http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/native-sql.html&quot; class=&quot;external-link&quot;&gt;http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/native-sql.html&lt;/a&gt; there are two Tables:&lt;/p&gt;

&lt;p&gt;*) users:&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;
   Column   |  Type   | Modifiers | Storage  | Description 
------------+---------+-----------+----------+-------------
 u_id       | integer | not &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;  | plain    | 
 u_name     | text    | not &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;  | extended | 
 address_id | integer | not &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;  | plain    | 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;*) address:&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;
  Column  |  Type   | Modifiers | Storage  | Description 
----------+---------+-----------+----------+-------------
 a_id     | integer | not &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;  | plain    | 
 a_street | text    | not &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;  | extended | 
 a_city   | text    | not &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;  | extended | 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;address_id is a foreign key to address;&lt;/p&gt;

&lt;p&gt;Now i created the Entities and setup a native query using ResultSetMappingBuilder:&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;
$rsm = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; \Doctrine\ORM\Query\ResultSetMappingBuilder($entityManager);
$rsm-&amp;gt;addRootEntityFromClassMetadata(&apos;MyProject\Entity\Users&apos;, &apos;u&apos;);
$rsm-&amp;gt;addJoinedEntityFromClassMetadata(&apos;MyProject\Entity\Address&apos;, &apos;a&apos;, &apos;u&apos;, &apos;address&apos;);

$query = &apos;
    SELECT
        u.*,
        a.*
    FROM
        users u
    LEFT JOIN address a ON (u.address_id = a.a_id)
&apos;;

/** @&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;native&lt;/span&gt; \Doctrine\ORM\NativeQuery */
$&lt;span class=&quot;code-keyword&quot;&gt;native&lt;/span&gt; = $entityManager-&amp;gt;createNativeQuery($query, $rsm);

$ret = $&lt;span class=&quot;code-keyword&quot;&gt;native&lt;/span&gt;-&amp;gt;getResult();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This returns the Entities correctly:&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;
array(2) {
  [0] =&amp;gt;
  class MyProject\Entity\Users#61 (3) {
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $id =&amp;gt;
    &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;(1)
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $name =&amp;gt;
    string(5) &lt;span class=&quot;code-quote&quot;&gt;&quot;Smith&quot;&lt;/span&gt;
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $address =&amp;gt;
    class MyProject\Entity\Address#63 (4) {
      &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $id =&amp;gt;
      &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;(1)
      &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $street =&amp;gt;
      string(8) &lt;span class=&quot;code-quote&quot;&gt;&quot;Broadway&quot;&lt;/span&gt;
      &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $city =&amp;gt;
      string(8) &lt;span class=&quot;code-quote&quot;&gt;&quot;New York&quot;&lt;/span&gt;
      &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $users =&amp;gt;
      class Doctrine\ORM\PersistentCollection#64 (9) {
        ...
      }
    }
  }
  [1] =&amp;gt;
  class MyProject\Entity\Users#66 (3) {
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $id =&amp;gt;
    &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;(2)
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $name =&amp;gt;
    string(7) &lt;span class=&quot;code-quote&quot;&gt;&quot;Sherlok&quot;&lt;/span&gt;
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $address =&amp;gt;
    class MyProject\Entity\Address#67 (4) {
      &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $id =&amp;gt;
      &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;(2)
      &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $street =&amp;gt;
      string(13) &lt;span class=&quot;code-quote&quot;&gt;&quot;Oxford Street&quot;&lt;/span&gt;
      &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $city =&amp;gt;
      string(6) &lt;span class=&quot;code-quote&quot;&gt;&quot;London&quot;&lt;/span&gt;
      &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $users =&amp;gt;
      class Doctrine\ORM\PersistentCollection#68 (9) {
        ...
      }
    }
  }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;BUT if you change the order of the select columns starting with ones from address you get borked Data:&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;
$query = &apos;
    SELECT
        a.*,
        u.*
    FROM
        users u
    LEFT JOIN address a ON (u.address_id = a.a_id)
&apos;;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&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;
array(2) {
  [0] =&amp;gt;
  class MyProject\Entity\Users#61 (3) {
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $id =&amp;gt;
    &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;(1)
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $name =&amp;gt;
    string(5) &lt;span class=&quot;code-quote&quot;&gt;&quot;Smith&quot;&lt;/span&gt;
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $address =&amp;gt;
    class MyProject\Entity\Address#63 (4) {
      &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $id =&amp;gt;
      &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;(2)
      &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $street =&amp;gt;
      string(13) &lt;span class=&quot;code-quote&quot;&gt;&quot;Oxford Street&quot;&lt;/span&gt;
      &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $city =&amp;gt;
      string(6) &lt;span class=&quot;code-quote&quot;&gt;&quot;London&quot;&lt;/span&gt;
      &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $users =&amp;gt;
      class Doctrine\ORM\PersistentCollection#64 (9) {
        ...
      }
    }
  }
  [1] =&amp;gt;
  class MyProject\Entity\Users#66 (3) {
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $id =&amp;gt;
    &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;(2)
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $name =&amp;gt;
    string(7) &lt;span class=&quot;code-quote&quot;&gt;&quot;Sherlok&quot;&lt;/span&gt;
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $address =&amp;gt;
    NULL
  }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This happens because the function Doctrine\ORM\Internal\Hydration\AbstractHydrator::_gatherRowData does not consider the Mapping i set up. Instead it just add the columns as they get starting with address ones.&lt;/p&gt;

&lt;p&gt;Doctrine\ORM\Internal\Hydration\ObjectHydrator::_hydrateRow then knows the Mapping and ignores the first Address as there is no User to map on, cycling to the next row will then add the address of the second row to the user from the first one.&lt;/p&gt;

&lt;p&gt;There are multiple ways to fix this. One would be to consider the mapping in _gatherRowData, the second to rewrite the _hydrateRow generating the Entities first and then the mapping in a second foreach loop.&lt;/p&gt;

&lt;p&gt;This bugger had me for 2 days until i finally figured it out.&lt;/p&gt;

&lt;p&gt;thanks&lt;/p&gt;</description>
                <environment>ubuntu kernel 2.6.32-40-server&lt;br/&gt;
php 5.3.10-1ubuntu2ppa6~lucid with Suhosin-Patch (cli)&lt;br/&gt;
apache 2 2.2.14-5ubuntu8.9&lt;br/&gt;
postgres 9.1.4-1~lucid4</environment>
            <key id="13900">DDC-1960</key>
            <summary>mapping joins in native queries breaks if select columns are starting with columns from joined table</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="dready">Thomas Subera</reporter>
                        <labels>
                    </labels>
                <created>Tue, 31 Jul 2012 11:23:21 +0000</created>
                <updated>Wed, 21 Nov 2012 23:48:37 +0000</updated>
                                    <version>2.1.4</version>
                <version>2.1.7</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="19022" author="frederes" created="Wed, 21 Nov 2012 23:30:34 +0000"  >&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;Has same issue with using DQL /createQuery() ! Try all the day to find where was my mistake but seems to be a CRITICAL bug !&lt;br/&gt;
How did you solve this ?&lt;/p&gt;


&lt;p&gt;Doctrine version used : 2.3.1-DEV&lt;/p&gt;

&lt;p&gt;&amp;lt;code&amp;gt;&lt;br/&gt;
$query = $this-&amp;gt;getEntityManager()-&amp;gt;createQuery(&quot;&lt;br/&gt;
            SELECT cc, oc&lt;br/&gt;
            FROM  category cc&lt;br/&gt;
                JOIN cc.offer_category oc&lt;br/&gt;
            WHERE cc.catalog = :catalog_id&lt;br/&gt;
            ORDER BY oc.name ASC&lt;br/&gt;
            &quot;)&lt;br/&gt;
            -&amp;gt;setParameter(&quot;:catalog_id&quot;, $catalog_id)&lt;br/&gt;
            ;&lt;/p&gt;

&lt;p&gt;&amp;lt;/code&amp;gt;&lt;/p&gt;

&lt;p&gt;Problem is that the order of the Aliases (cc, oc) is not considered on building SQL .&lt;br/&gt;
In my case, in the ObjectHydrator::hydrateRowData method :&lt;/p&gt;

&lt;p&gt;$rowData = $this-&amp;gt;gatherRowData($row, $cache, $id, $nonemptyComponents);&lt;/p&gt;

&lt;p&gt;returns &lt;/p&gt;

&lt;p&gt;Array&lt;br/&gt;
(&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;oc&amp;#93;&lt;/span&gt; =&amp;gt; Array&lt;br/&gt;
          (&lt;br/&gt;
            &lt;span class=&quot;error&quot;&gt;&amp;#91;id&amp;#93;&lt;/span&gt; =&amp;gt; 14&lt;br/&gt;
            &lt;span class=&quot;error&quot;&gt;&amp;#91;name&amp;#93;&lt;/span&gt; =&amp;gt; toto&lt;br/&gt;
        )&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;cc&amp;#93;&lt;/span&gt; =&amp;gt; Array&lt;br/&gt;
        (&lt;br/&gt;
            &lt;span class=&quot;error&quot;&gt;&amp;#91;catalog_id&amp;#93;&lt;/span&gt; =&amp;gt; 1&lt;br/&gt;
            &lt;span class=&quot;error&quot;&gt;&amp;#91;offer_category_id&amp;#93;&lt;/span&gt; =&amp;gt; 14&lt;br/&gt;
        )&lt;br/&gt;
)&lt;/p&gt;

&lt;p&gt;As &quot;oc&quot; is a mapping, on the first loop the $parentAlias is not yet known and so :&lt;br/&gt;
&amp;lt;code&amp;gt;&lt;br/&gt;
if ($this-&amp;gt;_rsm-&amp;gt;isMixed &amp;amp;&amp;amp; isset($this-&amp;gt;_rootAliases&lt;span class=&quot;error&quot;&gt;&amp;#91;$parentAlias&amp;#93;&lt;/span&gt;)) &lt;/p&gt;
{
                    echo &quot;parentObject 1\n&quot;;
                    $first = reset($this-&amp;gt;_resultPointers);
                    $parentObject = $first[key($first)];
                }
&lt;p&gt; else if (isset($this-&amp;gt;_resultPointers&lt;span class=&quot;error&quot;&gt;&amp;#91;$parentAlias&amp;#93;&lt;/span&gt;)) &lt;/p&gt;
{
                    echo $parentAlias.&quot; parentObject 2\n&quot;;
                    $parentObject = $this-&amp;gt;_resultPointers[$parentAlias];
                }
&lt;p&gt; else &lt;/p&gt;
{
                    // HERE : on first loop, for &quot;oc&quot;, parent not yet known so skipped !!!
                    continue;
                }
&lt;p&gt;&amp;lt;/code&amp;gt;&lt;/p&gt;

&lt;p&gt;using a workaround on ObjectHydrator::hydrateRowData like this :&lt;br/&gt;
$rowData = array_reverse($rowData);&lt;/p&gt;

&lt;p&gt;make it work...&lt;/p&gt;

&lt;p&gt;Sorry for my dirty explanation... &lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11215" name="testcase.zip" size="5941" author="dready" created="Tue, 31 Jul 2012 11:23:21 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1624] Locking CTI doesnt work on SQL Server</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1624</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;The WITH Keyowrd is appended to the whole FROM .. JOIN .. block instead of behind the FROM block.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13396">DDC-1624</key>
            <summary>Locking CTI doesnt work on SQL Server</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="beberlei">Benjamin Eberlei</reporter>
                        <labels>
                    </labels>
                <created>Sun, 29 Jan 2012 14:18:18 +0000</created>
                <updated>Thu, 20 Sep 2012 06:20:48 +0000</updated>
                                    <version>2.2</version>
                                <fixVersion>2.4</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1599] OnFlush event in transaction</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1599</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Is there any particular reason why onFlush event is not triggered when the transaction is allready open? &lt;a href=&quot;https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/UnitOfWork.php#L290&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/UnitOfWork.php#L290&lt;/a&gt; It would help a lot developing listeners since this event is the mostly used one and since theres preFlush now it seems a logical solution if onFlush would be a start of transaction in general&lt;/p&gt;</description>
                <environment></environment>
            <key id="13357">DDC-1599</key>
            <summary>OnFlush event in transaction</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="gediminasm">Gediminas Morkevicius</reporter>
                        <labels>
                    </labels>
                <created>Sat, 14 Jan 2012 15:51:55 +0000</created>
                <updated>Thu, 20 Sep 2012 06:20:49 +0000</updated>
                                    <version>Git Master</version>
                                <fixVersion>2.4</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="17244" author="beberlei" created="Sat, 14 Jan 2012 16:36:43 +0000"  >&lt;p&gt;onFluish is not the start of a transaction. It has nothing to do with this.&lt;/p&gt;</comment>
                    <comment id="17693" author="ocramius" created="Sat, 31 Mar 2012 02:07:52 +0000"  >&lt;p&gt;Is a third event needed? Or is this to be marked as &quot;won&apos;t fix&quot;?&lt;/p&gt;</comment>
                    <comment id="17695" author="beberlei" created="Sat, 31 Mar 2012 07:14:31 +0000"  >&lt;p&gt;Maybe onBeginTransaction, onCommit and onRollback.&lt;/p&gt;

&lt;p&gt;However since you can start transactions manually using $em-&amp;gt;beginTransaction(), the Flush events are somehwat independent of transactions anyways.&lt;/p&gt;</comment>
                    <comment id="17697" author="gediminasm" created="Sat, 31 Mar 2012 07:41:46 +0000"  >&lt;p&gt;Well, user can start transaction anytime, but the fact is that if we think ORM we do not know nothing about the database. we just persist and flush objects.&lt;/p&gt;

&lt;p&gt;Yes I think these would be very useful, from how I see it, if you use event listeners, is:&lt;/p&gt;

&lt;p&gt;loadClassMetadata: you can apply extra mapping&lt;/p&gt;

&lt;p&gt;onFlush: you can modify entity changesets, or persist recalculate new ones, without triggering the database, since it is not used to begin the database modifications yet.&lt;/p&gt;

&lt;p&gt;onBeginTransaction: could use the database modifications keeping in sync the entity changesets. the thing about this event is that usually in behavioral way atomic updates are required. for example nestedset tree sync lft rgt columns, sortable sync the sort index, materialized path, all these requires atomic updates, and the best place is the start of transaction.&lt;/p&gt;

&lt;p&gt;onCommit: could be useful to execute right before commit, finalizing database modifications could be done.&lt;/p&gt;

&lt;p&gt;onRollback: this one is really something, since if you go far, there might be something like files uploaded during the entity processing, and you may want to remove them if transaction fails.&lt;/p&gt;</comment>
                    <comment id="17958" author="guilhermeblanco" created="Mon, 21 May 2012 02:26:05 +0000"  >&lt;p&gt;This situation was barely documented here: &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-1443&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DDC-1443&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We need a better Transaction API that completely fixes the computation of changesets and also allow more fine grained control over Entities and their corresponding information.&lt;/p&gt;

&lt;p&gt;I&apos;d postpone this one until 3.0.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1551] postFlush event listeners should be able to get a list of all flushed entities</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1551</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Testing the new Doctrine 2.2 Beta we finally got the postFlush event which is a nice way to handle things after all the DB work has finished. The main problem is that there is no way to get all the flushed entities. In the onFlush event you are able to use the getScheduledEntityUpdates/Inserts/Deletions but as these entities are flushed, those arrays are now empty. To solve this i see 2 aproaches:&lt;/p&gt;

&lt;p&gt;1. Not unseting the array that holds the scheduled entities so the getScheduledEntityUpdates/Inserts/Deletions still have data. Those arrays are reset just before finishing the commit method so maybe unsetting them one by one as they are flushed is not necessary&lt;br/&gt;
2. Unset the arrays but at the same time, fill another &quot;flushedEntities&quot; array with the flushed entities and then be able to get that array with a getFlushedEntities method&lt;/p&gt;

&lt;p&gt;I can make a patch if necessary, just wanted to know if that sounds ok before starting it &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</description>
                <environment></environment>
            <key id="13287">DDC-1551</key>
            <summary>postFlush event listeners should be able to get a list of all flushed entities</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="acasademont">Albert Casademont</reporter>
                        <labels>
                    </labels>
                <created>Wed, 21 Dec 2011 11:52:22 +0000</created>
                <updated>Wed, 23 May 2012 19:09:26 +0000</updated>
                                    <version>2.2</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>8</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="17971" author="jasper@nerdsweide.nl" created="Wed, 23 May 2012 19:08:43 +0000"  >&lt;p&gt;I agree that Doctrine\ORM\Event\PreFlushEventArgs should contain a record of flushed entities, preferably reachable by entity-insertions/updates/deletions and collection-updates/deletions.&lt;/p&gt;

&lt;p&gt;I have a project (using Doctrine 2.1) which wrapped the flush call in my own. My flush dispatches custom preFlush/postFlush events (as they didn&apos;t exist in Doctrine 2.1), where my postFlushEventArgs does contain such a record. I&apos;ve just upgraded my project to use Doctrine 2.2 and stumbled upon:&lt;/p&gt;

&lt;p&gt;Catchable fatal error: Argument 1 passed to Nw\Event\EntityEvent::postFlush() must be an instance of Nw\Event\Args\PostFlushEventArgs, instance of Doctrine\ORM\Event\PostFlushEventArgs given.&lt;/p&gt;

&lt;p&gt;It seems I&apos;ve now hooked into Doctrine&apos;s postFlush (because I named the events the same way). I have renamed my events to work around this error, but I&apos;d rather see my behavior implemented natively.&lt;/p&gt;

&lt;p&gt;PS: Using Doctrine 2.2.2 to be precise &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1507] State change detection for version incrementation (for optimistic locking) in combination with orphanRemoval</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1507</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;As i understand the documentation correctly, orphanRemoval associations have the meaning of a &quot;part of&quot; relationship. In the example (&lt;a href=&quot;http://www.doctrine-project.org/docs/orm/2.0/en/reference/working-with-associations.html#orphan-removal&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/docs/orm/2.0/en/reference/working-with-associations.html#orphan-removal&lt;/a&gt;) the adresses are part of the contact.&lt;/p&gt;

&lt;p&gt;In my opinion we should reason that the state of the adress consists of the states of all nested contacts. As a consequence we should flag the contact as &quot;dirty&quot; when the adresses change.&lt;/p&gt;

&lt;p&gt;This is relevant for optimistic locking scenarios or event handlers. In my application i tried to use optimistic locking for &quot;contacts&quot;, which does not work if i don&apos;t change anything in the contact but only in the nested addresses.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13212">DDC-1507</key>
            <summary>State change detection for version incrementation (for optimistic locking) in combination with orphanRemoval</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="georgwaechter">Georg W&#228;chter</reporter>
                        <labels>
                    </labels>
                <created>Wed, 23 Nov 2011 11:48:40 +0000</created>
                <updated>Sun, 27 Nov 2011 13:04:57 +0000</updated>
                                    <version>2.1.4</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="16921" author="beberlei" created="Sun, 27 Nov 2011 08:47:25 +0000"  >&lt;p&gt;This is still only an approvement, you can workaround this and handle is in your domain code.&lt;/p&gt;</comment>
                    <comment id="16922" author="georgwaechter" created="Sun, 27 Nov 2011 13:04:57 +0000"  >&lt;p&gt;Not in all cases. The first problem is that my domain code can&apos;t modify the version property, doctrine seems to block any manipulations to it. So i&apos;m not able to increment the variable myself.&lt;/p&gt;

&lt;p&gt;The only solution is to implement optimistic locking on my own or to add a dummy persistent boolean field that gets inversed by my domain code .. which would trigger the doctrine implementation for the optimistic locking.&lt;/p&gt;

&lt;p&gt;I think it&apos;s clear that the second option shouldn&apos;t be a choice. If doctrine doesn&apos;t handle the overall case exactly it should allow me to increment the version number myself.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1506] Possible Regression with OneToOne relation</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1506</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&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;/**
 * @ORM\Entity
 */
class Top
{
    /**
     * @ORM\Id
     * @ORM\Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;)
     * @ORM\GeneratedValue(strategy=&lt;span class=&quot;code-quote&quot;&gt;&quot;AUTO&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $id;
    /**
     * @ORM\OneToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;LevelOne&quot;&lt;/span&gt;, orphanRemoval=&lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;&quot;&lt;/span&gt;, cascade={&lt;span class=&quot;code-quote&quot;&gt;&quot;persist&quot;&lt;/span&gt;, &lt;span class=&quot;code-quote&quot;&gt;&quot;remove&quot;&lt;/span&gt;})
     */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $levelOne;
    
    &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;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setLevelOne(LevelOne $levelOne)
    {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;levelOne = $levelOne;
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getLevelOne()
    {
        &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;levelOne;
    }
}

/**
 * @ORM\Entity
 */
class LevelOne
{
    /**
     * @ORM\Id
     * @ORM\Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;)
     * @ORM\GeneratedValue(strategy=&lt;span class=&quot;code-quote&quot;&gt;&quot;AUTO&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $id;
    /**
     * @ORM\OneToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;LevelTwo&quot;&lt;/span&gt;, orphanRemoval=&lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;&quot;&lt;/span&gt;, cascade={&lt;span class=&quot;code-quote&quot;&gt;&quot;persist&quot;&lt;/span&gt;, &lt;span class=&quot;code-quote&quot;&gt;&quot;remove&quot;&lt;/span&gt;})
     */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $levelTwo;

    &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;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setId($id)
    {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;id = $id;
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setLevelTwo(LevelTwo $levelTwo)
    {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;levelTwo = $levelTwo;
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getLevelTwo()
    {
        &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;levelTwo;
    }
}

/**
 * @ORM\Entity
 */
class LevelTwo
{
    /**
     * @ORM\Id
     * @ORM\Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;)
     * @ORM\GeneratedValue(strategy=&lt;span class=&quot;code-quote&quot;&gt;&quot;AUTO&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $id;
    
    &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;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setId($id)
    {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;id = $id;
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;trying to clone objects&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;$top = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Top();
        $top-&amp;gt;setLevelOne(&lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; LevelOne());
        $top-&amp;gt;getLevelOne()-&amp;gt;setLevelTwo(&lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; LevelTwo());
        
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;em-&amp;gt;persist($top);
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;em-&amp;gt;flush();
        
        $newTop = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Top();
        $newTop-&amp;gt;setLevelOne(clone $top-&amp;gt;getLevelOne());
        $newTop-&amp;gt;getLevelOne()-&amp;gt;setId(&lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;);
        $newTop-&amp;gt;getLevelOne()-&amp;gt;getLevelTwo()-&amp;gt;setId(&lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;);
        
        var_dump($newTop-&amp;gt;getLevelOne()-&amp;gt;getId());
        var_dump($newTop-&amp;gt;getLevelOne()-&amp;gt;getLevelTwo()-&amp;gt;getId());
        
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;em-&amp;gt;persist($newTop);
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;em-&amp;gt;flush();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;the output is:&lt;br/&gt;
NULL&lt;br/&gt;
NULL&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;PDOException&amp;#93;&lt;/span&gt;                                                                                             &lt;br/&gt;
SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;23000&amp;#93;&lt;/span&gt;: Integrity constraint violation: 1062 Duplicate entry &apos;1&apos; for key &apos;UNIQ_82A72CD0778BC57F&apos; &lt;br/&gt;
(it duplicates level two entity)&lt;br/&gt;
I worked for a while with entities, in a certain set of entity properties it completely persisted into database, but without relation between level one and level two.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13211">DDC-1506</key>
            <summary>Possible Regression with OneToOne relation</summary>
                <type id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/subtask_alternate.png">Sub-task</type>
                    <parent id="13135">DDC-1461</parent>
                        <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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="n3b">Maxim</reporter>
                        <labels>
                    </labels>
                <created>Wed, 23 Nov 2011 10:06:02 +0000</created>
                <updated>Wed, 23 Nov 2011 10:06:02 +0000</updated>
                                    <version>2.1.2</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1924] Let SQLFilters know the query type it is being applied to</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1924</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I&apos;m making an access control system and would like to automatically filter all queries based current user, targetEntity type and query type. Query type is relevant as different permissions are needed by the user for SELECT, UPDATE, DELETE and INSERT queries.&lt;/p&gt;

&lt;p&gt;I can access the first two things in my filter easily enough, but I cannot find a way to have the filter know what type of query the filter is being applied to.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13851">DDC-1924</key>
            <summary>Let SQLFilters know the query type it is being applied to</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/reopened.png">Reopened</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="shne">Jan Knudsen</reporter>
                        <labels>
                    </labels>
                <created>Fri, 13 Jul 2012 09:23:12 +0000</created>
                <updated>Fri, 13 Jul 2012 10:59:35 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="18301" author="beberlei" created="Fri, 13 Jul 2012 09:42:32 +0000"  >&lt;p&gt;The Filter API only makes sense for SELECT clauses. Doctrine itself does not use DQL to do updates internally, so you need to use other mechanisms (EventListener) to prevent this operations if they are not allowed for a user.&lt;/p&gt;</comment>
                    <comment id="18302" author="shne" created="Fri, 13 Jul 2012 09:51:55 +0000"  >&lt;p&gt;But I can make custom DQL to update rows and would like to automatically filter this too.&lt;/p&gt;

&lt;p&gt;e.g. $em-&amp;gt;createQuery(&quot;UPDATE SomeEntity se SET se.field = &quot;updated!&quot;)-&amp;gt;execute();&lt;/p&gt;

&lt;p&gt;The lifecycle events preUpdate etc. are not called when doing custom DQL queries.&lt;/p&gt;

&lt;p&gt;Maybe it is bad practice and discouraged to do updates, inserts and deletes as custom DQL queries, but I would like to ensure that the other people in my organization can&apos;t accidentally bypass the Access Control, even if they make use of such bad practice.&lt;/p&gt;

&lt;p&gt;And if the filter API only makes sense for Select statements, why are filters applied to update/delete/etc. statements too?&lt;/p&gt;</comment>
                    <comment id="18304" author="beberlei" created="Fri, 13 Jul 2012 10:41:38 +0000"  >&lt;p&gt;Well, they are applied to DQL UPDATE/DELETE. But not not UPDATE/DELETE that works through the internals of Doctrine. So yes, you can use it to filter DQL DELETE/UPDATE, but doctrine does not do that internally.&lt;/p&gt;

&lt;p&gt;So you have to have two strategies, a DQL/SQL Filter - and Lifecycle events.&lt;/p&gt;</comment>
                    <comment id="18305" author="shne" created="Fri, 13 Jul 2012 10:59:19 +0000"  >&lt;p&gt;Which is fine by me. I already implemented the checks using lifecycle events before opening this issue. The access control is automatically handled when using the entitymanager and not custom DQL.&lt;/p&gt;

&lt;p&gt;Now I would also like to filter the custom DQL, but currently I can&apos;t, because as originally stated, the filter needs to know which type of query it is being applied to.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1882] AbstractQuery#getResultCacheId() should be public to be able to manage the cache</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1882</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;The method getResultCacheId of Doctrine\ORM\AbstractQuery should be public.&lt;/p&gt;

&lt;p&gt;I&apos;m trying to customize the cache refresh mechanism to clear previously cached objects in my app.&lt;br/&gt;
To do that I&apos;m adding a prefix to define regions in the cache.&lt;br/&gt;
To be able to set the Id&apos;s correctly (adding region prefixes) I need to get the &quot;normal&quot; hash doctrine were used in the normal scenario (trying to avoid introduce new code).&lt;br/&gt;
That&apos;s why I will prefer the method to be public.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13788">DDC-1882</key>
            <summary>AbstractQuery#getResultCacheId() should be public to be able to manage the cache</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="ignaciolarranaga">Ignacio Larranaga</reporter>
                        <labels>
                    </labels>
                <created>Tue, 19 Jun 2012 17:37:43 +0000</created>
                <updated>Tue, 19 Jun 2012 17:38:39 +0000</updated>
                                    <version>2.1.6</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="18099" author="ignaciolarranaga" created="Tue, 19 Jun 2012 17:38:39 +0000"  >&lt;p&gt;Attaching the patch despite is a trivial change.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11198" name="AbstractQuery.patch" size="762" author="ignaciolarranaga" created="Tue, 19 Jun 2012 17:38:39 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1879] Orphans are neither nulled nor removed when merging a graph of detached entities</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1879</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;When merging a graph of detached entities, the created entitied are created and the updated entities are updated but the non-present entities (which exist in the database but are not in the graph) are neither removed nor have them their association column nullified.&lt;/p&gt;

&lt;p&gt;Example :&lt;/p&gt;

&lt;p&gt;In my code I have 2 entities : Parent and Child. There is a OneToMany(cascade=&lt;/p&gt;
{&quot;all&quot;}
&lt;p&gt;, orphanRemoval=true) relation defined in Parent.&lt;/p&gt;

&lt;p&gt;In my database I have a Parent row with an id of 1, which has 3 Children with ids 1,2,3.&lt;/p&gt;

&lt;p&gt;When I write the following code, I expect the Parent with id 1 and the Child  with id 2 to be updated, a new Child to be created and the Child with id 1 and 3 to be deleted.&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;
$parent = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Parent(); $parent-&amp;gt;id = 1  &lt;span class=&quot;code-comment&quot;&gt;// detached entity
&lt;/span&gt;$existing_child = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Child(); $child-&amp;gt;id = 2 &lt;span class=&quot;code-comment&quot;&gt;// detached entity
&lt;/span&gt;$new_child = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Child(); &lt;span class=&quot;code-comment&quot;&gt;// &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; entity
&lt;/span&gt;$dinner-&amp;gt;addChild($existing_child);
$dinner-&amp;gt;addChild($new_child);

$em-&amp;gt;merge($dinner);

$em-&amp;gt;flush();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The objects I expect to be created and updated have the correct behaviour but the old children are not touched, they are still present in the database.&lt;/p&gt;</description>
                <environment>Doctrine 2.2.2&lt;br/&gt;
PHP 5.3.10 with Suhosin-Patch&lt;br/&gt;
mysql  Ver 14.14 Distrib 5.5.15, for osx10.7&lt;br/&gt;
Mac OS X 10.7 Lion</environment>
            <key id="13784">DDC-1879</key>
            <summary>Orphans are neither nulled nor removed when merging a graph of detached entities</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="10000" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/needinfo.png">Awaiting Feedback</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="systho">Philippe Van Eerdenbrugghe</reporter>
                        <labels>
                    </labels>
                <created>Mon, 18 Jun 2012 15:56:06 +0000</created>
                <updated>Wed, 23 Jan 2013 22:24:05 +0000</updated>
                                    <version>2.2.2</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="19384" author="ocramius" created="Wed, 23 Jan 2013 22:24:02 +0000"  >&lt;p&gt;I don&apos;t think this is valid. Orphan removal scheduling is handled only when an unit of work is available.&lt;/p&gt;

&lt;p&gt;What&apos;s the state of `$dinner` before your example? Can you `var_dump` it?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1852] Doctrine\ORM\Tools\SchemaValidator should check validity of lifecycle callbacks</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1852</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;The schema validator should analyze mapped lifecycle callbacks and:&lt;/p&gt;

&lt;p&gt; a) if some lifecycle callbacks were defined, but no @HasLifecycleCallbacks annotation/mapping was set, warn the user&lt;br/&gt;
 b) if some lifecycle callbacks were defined, but methods are not public, warn the user&lt;/p&gt;</description>
                <environment></environment>
            <key id="13752">DDC-1852</key>
            <summary>Doctrine\ORM\Tools\SchemaValidator should check validity of lifecycle callbacks</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="ocramius">Marco Pivetta</reporter>
                        <labels>
                    </labels>
                <created>Mon, 4 Jun 2012 09:47:12 +0000</created>
                <updated>Thu, 20 Sep 2012 06:20:48 +0000</updated>
                                    <version>Git Master</version>
                                <fixVersion>2.4</fixVersion>
                <fixVersion>2.x</fixVersion>
                <fixVersion>Git Master</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="18038" author="ocramius" created="Mon, 4 Jun 2012 22:25:23 +0000"  >&lt;p&gt;Existing PR at &lt;a href=&quot;https://github.com/doctrine/doctrine2/pull/361&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/pull/361&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1806] DQL with and without fetch join cause</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1806</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;When running following DQL in newly cleared EntityManager, with the provided entities (see attached archive or gist at &lt;a href=&quot;https://gist.github.com/2473775&quot; class=&quot;external-link&quot;&gt;https://gist.github.com/2473775&lt;/a&gt; ), results in different fetched association:&lt;/p&gt;

&lt;p&gt;DQL without join:&lt;br/&gt;
SELECT a FROM Entity\A a WHERE a.id = :id&lt;/p&gt;

&lt;p&gt;SQL without join:&lt;br/&gt;
SELECT a0_.a_id AS a_id0, a0_.id AS id1 FROM a a0_ WHERE a0_.a_id = ?&lt;/p&gt;

&lt;p&gt;Result without join:&lt;br/&gt;
$query-&amp;gt;getOneOrNullResult()&lt;del&gt;&amp;gt;getB()&lt;/del&gt;&amp;gt;getName(); // &apos;correct&apos;&lt;/p&gt;


&lt;p&gt;DQL with fetch join:&lt;br/&gt;
SELECT a, b FROM Entity\A a LEFT JOIN a.b b WHERE a.id = :id&lt;/p&gt;

&lt;p&gt;SQL with fetch join:&lt;br/&gt;
SELECT a0_.a_id AS a_id0, b1_.id AS id1, b1_.name AS name2, a0_.id AS id3 FROM a a0_ LEFT JOIN b b1_ ON a0_.id = b1_.id WHERE a0_.a_id = ?&lt;/p&gt;

&lt;p&gt;Result with fetch join:&lt;br/&gt;
$query-&amp;gt;getOneOrNullResult()&lt;del&gt;&amp;gt;getB()&lt;/del&gt;&amp;gt;getName(); // &apos;wrong&apos; (different result)&lt;/p&gt;


&lt;p&gt;The problem seems to be strictly related with how the `@JoinColumn` is configured.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13675">DDC-1806</key>
            <summary>DQL with and without fetch join cause</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="ocramius">Marco Pivetta</reporter>
                        <labels>
                    </labels>
                <created>Tue, 1 May 2012 21:09:00 +0000</created>
                <updated>Tue, 1 May 2012 21:15:33 +0000</updated>
                                    <version>2.2</version>
                <version>2.2.1</version>
                <version>2.2.2</version>
                <version>Git Master</version>
                                                <component>DQL</component>
                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="17900" author="ocramius" created="Tue, 1 May 2012 21:15:32 +0000"  >&lt;p&gt;Attaching failing test from &lt;a href=&quot;https://github.com/Ocramius/doctrine2/compare/DDC-1806&quot; class=&quot;external-link&quot;&gt;https://github.com/Ocramius/doctrine2/compare/DDC-1806&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11188" name="DDC1806Test.php" size="2518" author="ocramius" created="Tue, 1 May 2012 21:15:32 +0000" />
                    <attachment id="11187" name="gist2473775-d202a38fdfb91921ef010df36322fb646561593a.tar.gz" size="19832" author="ocramius" created="Tue, 1 May 2012 21:09:00 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1803] Paginator usage with a DQL query that is using 2 time the same named binded value failed</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1803</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I use a dql query where I bind a named parameter 2 time in the same query for different joined fields.  The query work but the count query failed saying that there are missing bind variable.&lt;/p&gt;

&lt;p&gt;ex:&lt;br/&gt;
$qb = $this-&amp;gt;getQueryBuilder()&lt;br/&gt;
            -&amp;gt;select(&apos;&lt;br/&gt;
                partial fl.&lt;/p&gt;
{id, title, listing_date, abstract}
&lt;p&gt;,&lt;br/&gt;
                partial fla.&lt;/p&gt;
{id},&lt;br/&gt;
                partial ca.{id}
&lt;p&gt;,&lt;br/&gt;
                partial ds.&lt;/p&gt;
{id}
&lt;p&gt;            &apos;)&lt;br/&gt;
            -&amp;gt;from(&apos;Fo_Listing&apos;, &apos;fl&apos;)&lt;br/&gt;
            -&amp;gt;join(&apos;fl.listing_properties&apos;, &apos;flp&apos;)&lt;br/&gt;
            -&amp;gt;join(&apos;flp.property&apos;, &apos;fp&apos;)&lt;br/&gt;
            -&amp;gt;leftjoin(&apos;fl.listing_assets&apos;, &apos;fla&apos;)&lt;br/&gt;
            -&amp;gt;leftjoin(&apos;fla.asset&apos;, &apos;ca&apos;)&lt;br/&gt;
            -&amp;gt;leftjoin(&apos;ca.ds&apos;, &apos;ds&apos;)&lt;br/&gt;
            -&amp;gt;where(&apos;fp.id = :propertyId&apos;)&lt;br/&gt;
                -&amp;gt;setParameter(&apos;propertyId&apos;, $id)&lt;br/&gt;
            -&amp;gt;andWhere(&apos;fl.object_status_id &amp;lt;&amp;gt; :deleted&apos;)&lt;br/&gt;
                -&amp;gt;setParameter(&apos;deleted&apos;, CoRefObjectStatus::DELETE)&lt;br/&gt;
            -&amp;gt;andWhere(&apos;fl.publishing_status_id = :published&apos;)&lt;br/&gt;
                -&amp;gt;setParameter(&apos;published&apos;, CoRefPublishingStatus::PUBLISHED)&lt;br/&gt;
            -&amp;gt;andWhere(&apos;fp.object_status_id &amp;lt;&amp;gt; :deleted&apos;)&lt;br/&gt;
                -&amp;gt;setParameter(&apos;deleted&apos;, CoRefObjectStatus::DELETE)&lt;br/&gt;
            -&amp;gt;andWhere(&apos;fp.publishing_status_id = :published&apos;)&lt;br/&gt;
                -&amp;gt;setParameter(&apos;published&apos;, CoRefPublishingStatus::PUBLISHED)&lt;br/&gt;
            -&amp;gt;add(&apos;orderBy&apos;, &apos;fl.listing_date DESC, fl.published_date DESC&apos;)&lt;br/&gt;
            -&amp;gt;setMaxResults($onTheMarketLimit);&lt;/p&gt;

&lt;p&gt;        $onTheMarket = new Paginator($qb, $fetchJoin = true);&lt;/p&gt;

&lt;p&gt;To make it work, I&apos;ve renamed the second usage of the named variable with a 2 at the end.  deleted2 and published2.&lt;/p&gt;</description>
                <environment>linux, oracle</environment>
            <key id="13669">DDC-1803</key>
            <summary>Paginator usage with a DQL query that is using 2 time the same named binded value failed</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="10000" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/needinfo.png">Awaiting Feedback</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="mdrolet">Marc Drolet</reporter>
                        <labels>
                    </labels>
                <created>Mon, 30 Apr 2012 12:41:44 +0000</created>
                <updated>Fri, 25 Jan 2013 15:29:52 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="19385" author="ocramius" created="Wed, 23 Jan 2013 22:27:08 +0000"  >&lt;p&gt;This seems to be quite old. &lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=mdrolet&quot; class=&quot;user-hover&quot; rel=&quot;mdrolet&quot;&gt;Marc Drolet&lt;/a&gt; is it still valid with the latest ORM?&lt;/p&gt;</comment>
                    <comment id="19406" author="mdrolet" created="Fri, 25 Jan 2013 15:27:21 +0000"  >&lt;p&gt;I&apos;ll try to test this problem on an updated version and I&apos;ll let you know.&lt;br/&gt;
The bug entry is also quite old and I&apos;ve a local modified version of the paginator here to make it work with oracle, so it can take some time before I can test this out on the current doctrine version.&lt;/p&gt;</comment>
                    <comment id="19407" author="ocramius" created="Fri, 25 Jan 2013 15:29:48 +0000"  >&lt;p&gt;Ok, marking as awaiting feedback&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1756] Allow for master table only models on joined subclass inheritance</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1756</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Think of a joined subclass inheritance setup where abstract base class A has many concrete child classes C1 ... CN. For each child class a table necessarily has to created. Yet if there are many child classes not defining any additional fields you will get many &quot;id only&quot; child tables. This leads to unnecessary join and insert overhead on database operations as well as a bunch of quite senseless tables in your schema that need to be maintained.&lt;/p&gt;

&lt;p&gt;While there are already tickets requesting support for mixed inheritance mapping (e.g. &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-138&quot; title=&quot;Allow for mixed inheritance mapping&quot;&gt;DDC-138&lt;/a&gt;) I want to propose another - obviously easy to implement - solution that addresses the &quot;id only table&quot; problem. The basic idea is to extend ClassMetadata by a flag &quot;hasOwnTable&quot; which is true by default and applicable for child classes of a joined subclass tree. Setting this flag to &amp;lt;false&amp;gt; would lead to...&lt;br/&gt;
1.) no child table creation for corresponding model&lt;br/&gt;
2.) no joins to this table while rendering SQL from DQL statements&lt;br/&gt;
3.) no INSERT, UPDATE and DELETE statements for this table in methods executeInserts(), update() and delete() on Doctrine\ORM\Persisters\JoinedSubclassPersister.&lt;/p&gt;

&lt;p&gt;(3) can easily be implemented since the mentioned methods all loop on ClassMetadata::parentClasses. For those classes which set the flag &quot;hasOwnTable&quot; to false the operation will be skipped. On the other hand (2) doesn&apos;t seem to a big deal either. Extending SqlWalker::_generateClassTableInheritanceJoins() by means of a flag test seems to be enough. Of course setting the flag to &amp;lt;false&amp;gt; while defining additional fields on child class level must be rejected.&lt;/p&gt;

&lt;p&gt;If you go for this feature I would be pleased to provide an implementation.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13595">DDC-1756</key>
            <summary>Allow for master table only models on joined subclass inheritance</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="markus.woessner">Markus W&#246;&#223;ner</reporter>
                        <labels>
                    </labels>
                <created>Tue, 3 Apr 2012 11:41:01 +0000</created>
                <updated>Tue, 3 Apr 2012 11:41:01 +0000</updated>
                                    <version>Git Master</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2264] Add support for custom Oracle SID / Service name in PDO_Oracle driver</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2264</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Some Oracle customer databases are set up having different settings for their &quot;DBNAME&quot; and &quot;SID&quot; / &quot;SERVICE&quot; property. (DBNAME != SID)&lt;/p&gt;

&lt;p&gt;So, hereing it&apos;s currently not possible to connect via the PDO_Oracle driver (Class: Doctrine\DBAL\Driver\PDOOracle\Driver) as it uses the DBNAME value by default as value for SID / SERVICE in the _constructPdoDsn() method. (DBNAME = SID)&lt;/p&gt;

&lt;p&gt;A solution would be to add an additional config param like &quot;servicename&quot; and pass it&apos;s value into _constructPdoDsn().&lt;/p&gt;

&lt;p&gt;An updated version of the method could look like:&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;private function _constructPdoDsn(array $params)&lt;br/&gt;
{&lt;br/&gt;
    $dsn = &apos;oci:&apos;;&lt;br/&gt;
    if (isset($params&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;host&amp;#39;&amp;#93;&lt;/span&gt;) &amp;amp;&amp;amp; $params&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;host&amp;#39;&amp;#93;&lt;/span&gt; != &apos;&apos;) {&lt;br/&gt;
        $dsn .= &apos;dbname=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)&apos; .&lt;br/&gt;
               &apos;(HOST=&apos; . $params&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;host&amp;#39;&amp;#93;&lt;/span&gt; . &apos;)&apos;;&lt;/p&gt;

&lt;p&gt;        if (isset($params&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;port&amp;#39;&amp;#93;&lt;/span&gt;)) &lt;/p&gt;
{
            $dsn .= &apos;(PORT=&apos; . $params[&apos;port&apos;] . &apos;)&apos;;
        }
&lt;p&gt; else &lt;/p&gt;
{
            $dsn .= &apos;(PORT=1521)&apos;;
        }

&lt;p&gt;		if (isset($params&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;servicename&amp;#39;&amp;#93;&lt;/span&gt;) &amp;amp;&amp;amp; $params&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;servicename&amp;#39;&amp;#93;&lt;/span&gt; != &apos;&apos;)&lt;/p&gt;
		{
			$servicename	=	$params[&apos;servicename&apos;];
		}
&lt;p&gt;		else&lt;/p&gt;
		{
			$servicename	=	$params[&apos;dbname&apos;];
		}

&lt;p&gt;        if (isset($params&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;service&amp;#39;&amp;#93;&lt;/span&gt;) &amp;amp;&amp;amp; $params&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;service&amp;#39;&amp;#93;&lt;/span&gt; == true) &lt;/p&gt;
{
            $dsn .= &apos;))(CONNECT_DATA=(SERVICE_NAME=&apos; . $servicename . &apos;)))&apos;;
        }
&lt;p&gt; else &lt;/p&gt;
{
            $dsn .= &apos;))(CONNECT_DATA=(SID=&apos; . $servicename . &apos;)))&apos;;
        }

&lt;p&gt;    } else &lt;/p&gt;
{
        $dsn .= &apos;dbname=&apos; . $params[&apos;dbname&apos;];
    }

&lt;p&gt;    if (isset($params&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;charset&amp;#39;&amp;#93;&lt;/span&gt;)) &lt;/p&gt;
{
        $dsn .= &apos;;charset=&apos; . $params[&apos;charset&apos;];
    }

&lt;p&gt;    return $dsn;&lt;br/&gt;
}&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;The only workaround for me is right now to use the &quot;standard&quot; PHP OCI / OCI8 functions with the correct SID / Service in it&apos;s DSN.&lt;/p&gt;</description>
                <environment></environment>
            <key id="14430">DDC-2264</key>
            <summary>Add support for custom Oracle SID / Service name in PDO_Oracle driver</summary>
                <type id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/task.png">Task</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>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="michl">Michl Schmid</reporter>
                        <labels>
                        <label>oracle</label>
                    </labels>
                <created>Tue, 29 Jan 2013 10:16:55 +0000</created>
                <updated>Tue, 29 Jan 2013 10:16:55 +0000</updated>
                                    <version>2.0</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2141] Query should not be final</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2141</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;The Query class should not be marked final as this makes it impossible to Mock it.&lt;/p&gt;
</description>
                <environment>All</environment>
            <key id="14219">DDC-2141</key>
            <summary>Query should not be final</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="tarjei">Tarjei Huse</reporter>
                        <labels>
                    </labels>
                <created>Tue, 13 Nov 2012 09:59:23 +0000</created>
                <updated>Tue, 13 Nov 2012 09:59:23 +0000</updated>
                                    <version>Git Master</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1732] Unserialized non-initialized proxy classes should throw an exception when a method is called</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1732</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;When we serialize entities in a session, we often have pointers to uninitialized proxies.&lt;br/&gt;
These proxies have $_entityPersister == null.&lt;/p&gt;

&lt;p&gt;The problem is that if you happen to call by mistake a method on such a proxy, you&apos;re not aware that this is an uninitialized proxy, and the business methods are called, with null values for every property.&lt;/p&gt;

&lt;p&gt;I think the proxy should throw an exception in that case.&lt;br/&gt;
Attached, a patch with the proposed modification.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13568">DDC-1732</key>
            <summary>Unserialized non-initialized proxy classes should throw an exception when a method is called</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="benjamin">Benjamin Morel</reporter>
                        <labels>
                    </labels>
                <created>Wed, 28 Mar 2012 19:29:13 +0000</created>
                <updated>Wed, 28 Mar 2012 19:29:13 +0000</updated>
                                    <version>2.2</version>
                <version>Git Master</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                                <attachments>
                    <attachment id="11173" name="ProxyFactory.php.patch" size="679" author="benjamin" created="Wed, 28 Mar 2012 19:29:13 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1728] There is no exact alternative function like MONTH in mysql </title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1728</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;i am not able to extract only month from the date field using doctrine2 using &apos;MONTH&apos; function&lt;/p&gt;</description>
                <environment>Ubuntu 11.10</environment>
            <key id="13563">DDC-1728</key>
            <summary>There is no exact alternative function like MONTH in mysql </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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="sudheeshms1">Sudheesh MS</reporter>
                        <labels>
                    </labels>
                <created>Tue, 27 Mar 2012 13:44:12 +0000</created>
                <updated>Tue, 27 Mar 2012 13:44:12 +0000</updated>
                                    <version>2.2.0-RC1</version>
                <version>2.2</version>
                <version>2.2.1</version>
                                                <component>DQL</component>
                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1729] Translate queries into graphs of value objects (instead of array hydration?)</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1729</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;In decoupled applications the model layer returns &quot;data-transfer-objects&quot; through the boundary into the controller/view layer. It would make sense to have Doctrine directly generate any data-transfer/value-object from native and dql queries.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13564">DDC-1729</key>
            <summary>Translate queries into graphs of value objects (instead of array hydration?)</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="beberlei">Benjamin Eberlei</reporter>
                        <labels>
                    </labels>
                <created>Tue, 27 Mar 2012 22:35:35 +0000</created>
                <updated>Sat, 9 Jun 2012 11:26:40 +0000</updated>
                                                    <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="18067" author="beberlei" created="Sat, 9 Jun 2012 11:26:40 +0000"  >&lt;p&gt;Example:&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;$dql = &quot;SELECT &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; CustomerAddressView(c.id, c.name, a.id, a.street, a.number, a.city, a.code)
             FROM Customer c INNER JOIN c.address a WHERE c.id = ?1&quot;;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This supersedes &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-1819&quot; title=&quot;Allow ResultSetMapping to be used for objects that are not entities&quot;&gt;DDC-1819&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;1. One additional property in ResultSetMapping =&amp;gt; $viewModelClass?&lt;br/&gt;
2. Changes to Parser (new ... syntax)&lt;br/&gt;
3. Changes to sQL Walker?&lt;br/&gt;
4. Changes to Hydration (Only object hydration!)&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1721] LIKE clausule should accept functions on the pattern</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1721</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Example:&lt;br/&gt;
SELECT .... WHERE upper(n.title) LIKE upper(:filter)&lt;/p&gt;

&lt;p&gt;should be a valid SQL, now is rejected because the walker only accept a variable or an string expression.&lt;/p&gt;

&lt;p&gt;I&apos;m adding a patch to address this.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13548">DDC-1721</key>
            <summary>LIKE clausule should accept functions on the pattern</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="ignaciolarranaga">Ignacio Larranaga</reporter>
                        <labels>
                    </labels>
                <created>Wed, 21 Mar 2012 17:40:33 +0000</created>
                <updated>Thu, 24 Jan 2013 18:06:45 +0000</updated>
                                    <version>2.1.6</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="17625" author="ignaciolarranaga" created="Wed, 21 Mar 2012 19:30:31 +0000"  >&lt;p&gt;Sorry the Parser has to be modified also to allow expressions to be recognized, I&apos;m attaching the necessary patch.&lt;/p&gt;</comment>
                    <comment id="17626" author="beberlei" created="Thu, 22 Mar 2012 19:31:32 +0000"  >&lt;p&gt;I am sure there is a reason why the walker doesn&apos;t accept this such as not all supported vendors allowing functions in right hand side LIKE expressions, but i am not sure about this.&lt;/p&gt;</comment>
                    <comment id="18764" author="darkangel" created="Wed, 3 Oct 2012 09:46:44 +0000"  >&lt;p&gt;This is not possible either:&lt;/p&gt;

&lt;p&gt;WHERE CASE WHEN p.name IS NULL THEN u.username ELSE p.name END LIKE :name&lt;/p&gt;</comment>
                    <comment id="19403" author="thomas303" created="Thu, 24 Jan 2013 18:06:45 +0000"  >&lt;p&gt;In my case it worked when using &quot;=&quot; instead of &quot;LIKE&quot;.&lt;/p&gt;

&lt;p&gt;//works:&lt;br/&gt;
(CASE WHEN (Book.id = BookFrom.id) THEN BookTo.displayName ELSE BookFrom.displayName END) = :name&lt;/p&gt;

&lt;p&gt;//&lt;span class=&quot;error&quot;&gt;&amp;#91;Syntax Error&amp;#93;&lt;/span&gt; line 0, col 1217: Error: Expected =, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, &amp;gt;, &amp;gt;=, !=, got &apos;LIKE&apos; &lt;br/&gt;
(CASE WHEN (Book.id = BookFrom.id) THEN BookTo.displayName ELSE BookFrom.displayName END) LIKE :name&lt;/p&gt;

&lt;p&gt;So the LIKE operator only needs to be allowed here.&lt;/p&gt;

&lt;p&gt;I&apos;m wondering which vendor should not be able to handle that:&lt;br/&gt;
The CASE WHEN ... THEN ... END is documented in DQL, and allowed.&lt;br/&gt;
LIKE itself is allowed.&lt;br/&gt;
If an RDBMs cannot use CASE WHEN and LIKE in combination, this would be a strange limitation.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11172" name="Parser.patch" size="847" author="ignaciolarranaga" created="Wed, 21 Mar 2012 19:30:31 +0000" />
                    <attachment id="11171" name="SqlWalker.patch" size="891" author="ignaciolarranaga" created="Wed, 21 Mar 2012 17:40:33 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1714] Prevent inverse side lazy loading owning side of the oneToOne relationsip if owning side&apos;s id is an assosiationKey of inversed side</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1714</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;This issue was originally discussed in &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-357&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DDC-357&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Say there is User and UserData with oneToOne bidirectional relationship. When we fetch User objects, UserData is lazy loaded right away. &lt;/p&gt;

&lt;p&gt;If we were to set UserData &apos;s id as asssosiationKey of User, then user_id becomes the id of UserData and User object can already know that UserData owning side&apos;s id will equal it&apos;s own User-&amp;gt;id.&lt;/p&gt;

&lt;p&gt;Can this be implemented?&lt;/p&gt;</description>
                <environment></environment>
            <key id="13540">DDC-1714</key>
            <summary>Prevent inverse side lazy loading owning side of the oneToOne relationsip if owning side&apos;s id is an assosiationKey of inversed side</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="dwalter">David</reporter>
                        <labels>
                    </labels>
                <created>Sun, 18 Mar 2012 23:56:32 +0000</created>
                <updated>Sun, 18 Mar 2012 23:56:32 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1720] SqlWalter private variables should be protected to allow walker extensions</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1720</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I&apos;m attaching a patch with the suggestion.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13547">DDC-1720</key>
            <summary>SqlWalter private variables should be protected to allow walker extensions</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="ignaciolarranaga">Ignacio Larranaga</reporter>
                        <labels>
                    </labels>
                <created>Wed, 21 Mar 2012 16:44:52 +0000</created>
                <updated>Wed, 21 Mar 2012 16:45:25 +0000</updated>
                                    <version>2.1.6</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                    <attachment id="11170" name="SqlWalker.patch" size="2632" author="ignaciolarranaga" created="Wed, 21 Mar 2012 16:44:52 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1698] Inconsistent proxy file name &amp; namespace result in __PHP_Incomplete_Class when unserializing entities</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1698</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Starting with Doctrine 2.2, the Proxy classes have inconsistent naming with their file name, which raises problems with class autoloading.&lt;br/&gt;
For example, a class named &lt;b&gt;Application\Model\User&lt;/b&gt; creates the following proxy class:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;Application\Proxy\__CG__\Application\Model\User
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This class is located in the following file:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;Application/Proxy/__CG__ApplicationModelUser.php
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;But whe we serialize such an entity, then unserialize it in another session, the framework autoloader expects the class to be located in:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;Application/Proxy/__CG__/Application/Model/User.php
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;But it is not.&lt;br/&gt;
As a result, a __PHP_Incomplete_Class is created instead of the expected proxy class.&lt;/p&gt;

&lt;p&gt;I&apos;m not sure whether this is an intended behavior, but I would assume this is a bug.&lt;/p&gt;</description>
                <environment>Irrelevant</environment>
            <key id="13521">DDC-1698</key>
            <summary>Inconsistent proxy file name &amp; namespace result in __PHP_Incomplete_Class when unserializing entities</summary>
                <type id="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/documentation.png">Documentation</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/reopened.png">Reopened</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="benjamin">Benjamin Morel</reporter>
                        <labels>
                    </labels>
                <created>Tue, 13 Mar 2012 00:11:42 +0000</created>
                <updated>Sun, 6 Jan 2013 13:18:41 +0000</updated>
                                    <version>2.2</version>
                <version>2.2.1</version>
                                <fixVersion>2.2.2</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="17561" author="benjamin" created="Tue, 13 Mar 2012 16:46:38 +0000"  >&lt;p&gt;It looks like there is an even broader problem with the new _&lt;em&gt;CG&lt;/em&gt;_ prefix; the PSR-0 standard for autoloading states that the underscores should be handled this way:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;\namespace\package\Class_Name =&amp;gt; {...}/namespace/package/Class/Name.php
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Which means that in the above example, it could even expect the file to be located in:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;Application/Proxy///CG///Application/Model/User.php
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;... which is far away from the actual location.&lt;br/&gt;
Upgrade to 2.2 broke this code, for us.&lt;/p&gt;</comment>
                    <comment id="17565" author="beberlei" created="Wed, 14 Mar 2012 18:30:24 +0000"  >&lt;p&gt;Proxy classes do not follow PSR-0. For the case unserializing objects we should provide an extra autoloader i guess.&lt;/p&gt;

&lt;p&gt;See here how symfony does it &lt;a href=&quot;https://github.com/doctrine/DoctrineBundle/blob/master/DoctrineBundle.php#L57&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/DoctrineBundle/blob/master/DoctrineBundle.php#L57&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="17566" author="beberlei" created="Wed, 14 Mar 2012 19:12:07 +0000"  >&lt;p&gt;See &lt;a href=&quot;https://github.com/doctrine/doctrine2/commit/9b4d60897dfc7e9b165712428539e694ec596c80&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/commit/9b4d60897dfc7e9b165712428539e694ec596c80&lt;/a&gt; and &lt;a href=&quot;https://github.com/doctrine/orm-documentation/commit/01381fae1ff3d4944086c7cfe46721925bf6ca15&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/orm-documentation/commit/01381fae1ff3d4944086c7cfe46721925bf6ca15&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="17589" author="benjamin" created="Wed, 14 Mar 2012 22:36:59 +0000"  >&lt;p&gt;Thanks for the quick fix, Benjamin.&lt;br/&gt;
However, I have to admit that I&apos;m not fully happy with the fix, as we (and probably many others) are not using the Doctrine autoloader.&lt;br/&gt;
I supposed that the purpose of PSR-0 was precisely not to be tied to a particular autoloader implementation, and this benefit is lost with this version of Doctrine.&lt;/p&gt;

&lt;p&gt;You mentioned in the doc that the proxies are not PSR-0 compliant &quot;for implementation reasons&quot;; as this was working fine before 2.2, could you please explain what requirement prevents Doctrine from keeping the previous naming convention?&lt;/p&gt;</comment>
                    <comment id="17671" author="beberlei" created="Thu, 29 Mar 2012 09:56:11 +0000"  >&lt;p&gt;In 2.1 the proxies are not PSR-0 compatible themselves, however their class naming is simpler.&lt;/p&gt;

&lt;p&gt;In 2.2 we changed proxy names so that you can derive the original name of the proxy by searching for the _&lt;em&gt;CG&lt;/em&gt;_ flag. This flag obviously contains the __ chars that some PSR autoloaders detect as directory seperators. I agree this is an unfortunate decision, but it was done this way.&lt;/p&gt;

&lt;p&gt;I do think however that we can automatically register the proxy atuoloader (if not yet done)  in EntityManager#create(). This would hide this fact from developers automatically.&lt;/p&gt;</comment>
                    <comment id="18898" author="benjamin" created="Mon, 29 Oct 2012 21:37:00 +0000"  >&lt;p&gt;@Benjamin Eberlei&lt;br/&gt;
In 2.3 we still have to manually call Autoloader::register() before unserializing entities that may contain proxies.&lt;br/&gt;
So EntityManager::create() still doesn&apos;t register it. Is there a plan to add this feature?&lt;/p&gt;</comment>
                    <comment id="19231" author="beberlei" created="Sun, 6 Jan 2013 10:10:22 +0000"  >&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=benjamin&quot; class=&quot;user-hover&quot; rel=&quot;benjamin&quot;&gt;Benjamin Morel&lt;/a&gt; Not at the moment, seems too dangerous for me since it might produce race conditions. This should really be done in the bootstrap of the system.&lt;/p&gt;

&lt;p&gt;We need to document this though.&lt;/p&gt;</comment>
                    <comment id="19234" author="benjamin" created="Sun, 6 Jan 2013 13:18:41 +0000"  >&lt;p&gt;Ok, thanks for your answer!&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-265] Possibility for Nested Inheritance</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-265</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;It would be great if Doctrine had the possibility to define a further inharitance in a subclass.&lt;/p&gt;

&lt;p&gt;Example:&lt;br/&gt;
There is a class DataObject managing things like created- and lastedit-&lt;br/&gt;
timestamps, archiving objects before updates, ...&lt;br/&gt;
One of the sub-objects is Content.&lt;br/&gt;
There are several types of content.&lt;br/&gt;
Written directly to a database field, read from a textfile on server,&lt;br/&gt;
executed php file on server, loaded from another server via xmlrpc and&lt;br/&gt;
so on. &lt;/p&gt;

&lt;p&gt;I&apos;d like to use a single table inheritance to map all information of&lt;br/&gt;
the different content objects in one table.&lt;br/&gt;
If I understand the model right the only alternate solution would be&lt;br/&gt;
to write each single content object to the discriminator map of&lt;br/&gt;
DataObject. &lt;/p&gt;</description>
                <environment></environment>
            <key id="10756">DDC-265</key>
            <summary>Possibility for Nested Inheritance</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="quest">Michael F&#252;rmann</reporter>
                        <labels>
                    </labels>
                <created>Thu, 21 Jan 2010 06:27:37 +0000</created>
                <updated>Wed, 16 Jan 2013 08:16:23 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="11437" author="beberlei" created="Thu, 21 Jan 2010 09:30:09 +0000"  >&lt;p&gt;The DataObject you describe is a no-go for Doctrine 2. Its just a very bad practice.&lt;/p&gt;

&lt;p&gt;Inheritance Mapping is for REAL inheritance only, otherwise you shouldnt go with a relational database in the first place.&lt;/p&gt;

&lt;p&gt;You should use the Event system for such changes, it offers you roughly the same possibilities and keeps you from having to use inheritance mapping. You could still create an abstract data object and define the fields that will be used in each &quot;implementation&quot; and then in events do 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;&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($entity &lt;span class=&quot;code-keyword&quot;&gt;instanceof&lt;/span&gt; DataObject) {
     $entity-&amp;gt;updated();
     $archiver-&amp;gt;makeSnapshot($entity);
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="12380" author="jwage" created="Sat, 20 Mar 2010 01:54:15 +0000"  >&lt;p&gt;With this patch I think you could setup a nice similar model where you can introduce new children of this parent class and have it added to the discriminator map from the child instead of having to modify the parents mapping information.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-447&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DDC-447&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10000">
                <name>Duplicate</name>
                                <outwardlinks description="duplicates">
                            <issuelink>
            <issuekey id="10399">DDC-138</issuekey>
        </issuelink>
                    </outwardlinks>
                                            </issuelinktype>
                    </issuelinks>
                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-128] Consider adding EntityManager#link/unlink methods for direct association manipulation</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-128</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;A problem when working with collection-valued associations is that almost all operations except add($obj) require the collection to become initialized in order for the operation to be performed properly. While this is all correct and beautiful OO-wise it may be problematic at times with regards to performance. Hence we might want to consider to provide some convenient methods along the lines of link/unlink (name suggestions?) which allow more direct, less OO collection manipulation. Such methods obviously would bypass the normal object lifecycle and the changes done through these methods will not be reflected in the in-memory objects and collections, unless the user keeps them in-synch himself.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10362">DDC-128</key>
            <summary>Consider adding EntityManager#link/unlink methods for direct association manipulation</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="romanb">Roman S. Borschel</reporter>
                        <labels>
                    </labels>
                <created>Sat, 7 Nov 2009 13:31:39 +0000</created>
                <updated>Wed, 29 Dec 2010 06:32:36 +0000</updated>
                                    <version>2.0-ALPHA2</version>
                                <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>4</watches>
                        <comments>
                    <comment id="11174" author="beberlei" created="Fri, 11 Dec 2009 13:48:10 +0000"  >&lt;p&gt;Questions&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;I suppose link and unlinked entities would then handled by UnitOfwork commit also?&lt;/li&gt;
	&lt;li&gt;Since the collection is not initialized, one does not know upfront if the action will be successful, what happens if:
	&lt;ul&gt;
		&lt;li&gt;an entity is linked with a collection, although they are already connected.&lt;/li&gt;
		&lt;li&gt;an entity is unlinked from a collection it is not in.&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Regarding the naming, i like link/unlink.&lt;/p&gt;
</comment>
                    <comment id="11211" author="romanb" created="Thu, 17 Dec 2009 13:56:23 +0000"  >&lt;p&gt;What do you mean by &quot;handled by UnitOfWork commit&quot; ? Whether the SQL is &quot;scheduled&quot; or executed immediately? Interesting question.&lt;br/&gt;
Scheduling would probably be better but also more difficult.&lt;/p&gt;

&lt;p&gt;As far as usage is concerned, I currently imagine it as follows:&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;&lt;span class=&quot;code-comment&quot;&gt;// EntityManager#link($sourceObj, $field, $targetObj)
&lt;/span&gt;$user = $em-&amp;gt;getReference($userId); &lt;span class=&quot;code-comment&quot;&gt;// $userId probably from request parameters
&lt;/span&gt;$address = $em-&amp;gt;getReference($addressId); &lt;span class=&quot;code-comment&quot;&gt;// $addressId probably from request parameters
&lt;/span&gt;$em-&amp;gt;link($user, &apos;addresses&apos;, $address);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&quot;What happens if: an entity is linked with a collection, although they are already connected.&quot;&lt;/p&gt;

&lt;p&gt;Probably an SQL error which results in an exception from the driver. Depends on the database constraints though.&lt;/p&gt;

&lt;p&gt;&quot;What happens if: an entity is unlinked from a collection it is not in&quot;&lt;/p&gt;

&lt;p&gt;Probably nothing, at least not from the SQL side. An exception could be thrown from Doctrine itself if the update affected 0 rows.&lt;/p&gt;

&lt;p&gt;Thanks for these initial questions. Thats definitely food for thought. Keep it coming.&lt;/p&gt;</comment>
                    <comment id="14080" author="romanb" created="Thu, 26 Aug 2010 08:00:25 +0000"  >&lt;p&gt;Pushed back.&lt;/p&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10001">
                <name>Reference</name>
                                                <inwardlinks description="is referenced by">
                            <issuelink>
            <issuekey id="11277">DDC-546</issuekey>
        </issuelink>
                    </inwardlinks>
                            </issuelinktype>
                    </issuelinks>
                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-54] Trigger postLoad events and callbacks after associations have been initialized</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-54</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Currently the postLoad events and callbacks are triggered after the entity has been created and filled with its &quot;primitive&quot; state but before associations are available. The postLoad events and callbacks should be postponed so that they are triggered after associations have been initialized.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10198">DDC-54</key>
            <summary>Trigger postLoad events and callbacks after associations have been initialized</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/inprogress.png">In Progress</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="romanb">Roman S. Borschel</reporter>
                        <labels>
                    </labels>
                <created>Thu, 15 Oct 2009 18:34:38 +0000</created>
                <updated>Thu, 11 Oct 2012 10:37:46 +0000</updated>
                                    <version>2.0-ALPHA2</version>
                                <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>6</votes>
                        <watches>6</watches>
                        <comments>
                    <comment id="14159" author="romanb" created="Mon, 30 Aug 2010 06:36:48 +0000"  >&lt;p&gt;If this is to be included in 2.0 it needs to happen for RC1. However, it is not clear yet whether it will be done in time.&lt;/p&gt;</comment>
                    <comment id="14454" author="beberlei" created="Thu, 23 Sep 2010 17:57:07 +0000"  >&lt;p&gt;How would you solve this Roman? I thought of adding a query hint so that the postLoad inside unit of work is not triggered and gathering all the entities that have a post load event in an array inside the object hydrator, then iterating it after taking the snapshots of all collections inside hydrateAll&lt;/p&gt;</comment>
                    <comment id="14461" author="romanb" created="Fri, 24 Sep 2010 14:37:25 +0000"  >&lt;p&gt;@Benjamin: Not sure what you would use the query hint for but in general that is the approach I had in mind, yes. You can&apos;t get around iterating over the entities after the actual hydration.&lt;/p&gt;</comment>
                    <comment id="14477" author="beberlei" created="Mon, 27 Sep 2010 16:45:30 +0000"  >&lt;p&gt;The query hint would do 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;        &lt;span class=&quot;code-comment&quot;&gt;//TODO: These should be invoked later, after hydration, because associations may not yet be loaded here.
&lt;/span&gt;        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (isset($class-&amp;gt;lifecycleCallbacks[Events::postLoad]) &amp;amp;&amp;amp; !isset($hints[&apos;hydrationPostLoad&apos;])) {
            $class-&amp;gt;invokeLifecycleCallbacks(Events::postLoad, $entity);
        }
        &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;evm-&amp;gt;hasListeners(Events::postLoad) &amp;amp;&amp;amp; !isset($hints[&apos;hydrationPostLoad&apos;])) {
            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;evm-&amp;gt;dispatchEvent(Events::postLoad, &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; LifecycleEventArgs($entity, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;em));
        }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;another way would be to move that code out of UoW::createEntity completly and have the persisters call it when they use that method.&lt;/p&gt;</comment>
                    <comment id="14486" author="romanb" created="Tue, 28 Sep 2010 16:11:38 +0000"  >&lt;p&gt;Leaving that code in UoW does not make sense to me, if it is moved, it needs to be moved completely. Why do you think the persisters should do it? Initially I thought collecting the affected entities during hydration and then when hydration is done iterating over them and triggering the postLoad events.&lt;/p&gt;</comment>
                    <comment id="14488" author="beberlei" created="Tue, 28 Sep 2010 16:30:04 +0000"  >&lt;p&gt;Yes but postLoad has to be triggered for non Hydrated entities (i.e. Persister) also&lt;/p&gt;</comment>
                    <comment id="14620" author="beberlei" created="Sat, 30 Oct 2010 11:36:57 +0000"  >&lt;p&gt;Moved back&lt;/p&gt;</comment>
                    <comment id="17849" author="cakper" created="Sun, 15 Apr 2012 19:51:18 +0000"  >&lt;p&gt;Hi Gyus, I need access to associations in postLoad or similar event, and my idea is to dispatch new event after full initialisation of object, what do You think about it? If I can help please let me know &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; It&apos;s important for me.&lt;/p&gt;</comment>
                    <comment id="18731" author="brizzz" created="Tue, 25 Sep 2012 21:41:06 +0000"  >&lt;p&gt;Now in my PostLoad access to associations is work fine. Why this issue is still in Unresolved status?&lt;/p&gt;</comment>
                    <comment id="18822" author="chives" created="Thu, 11 Oct 2012 10:37:46 +0000"  >&lt;p&gt;What do you (Roman and Benjamin) think about adding postHydrate event which would be called within ObjectHydrator::hydrateAllData() on every entity collected during hydration? I could prepare a patch for this. I personally think this would be better than adding a hint that changes behaviour of postLoad event.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-298] Allow Entity to hold a collection of a single primitive type</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-298</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Sometimes you want to save arbitrary information for an entity using a key -&amp;gt; value array-structure. JPA supports this by means of the @ElementCollection annotation with allows to specify HashMaps for example.&lt;/p&gt;

&lt;p&gt;I propose a new AssocationMapping called &quot;ElementMapping&quot; / &quot;ElementCollection&quot; and annotations (options):&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;ElementCollection
+ elementTable
+ keyType
+ keyLength
+ keyColumnDefinition
+ valueType
+ valueLength
+ valueColumnDefinition
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The key and value definitions are necessary for converting and schema generation.&lt;/p&gt;

&lt;p&gt;The implementation would make use of the PersistentCollection at all times and work as any other persistent collection just with primitive types.&lt;/p&gt;

&lt;p&gt;Restrictions for a first implementation:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Only available as a Lazy-Load Collection, no hydration with the source entity&lt;/li&gt;
	&lt;li&gt;Can&apos;t be used in queries alike &quot;entity.colname.key = ?1&quot;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Use-Case:&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;$entity-&amp;gt;options[&apos;foo&apos;] = &apos;bar&apos;;
$entity-&amp;gt;options[&apos;bar&apos;] = &apos;baz&apos;;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This could be done for 2.0 imho, adding the necessary changes and optimizations could then be scheduled for 2.1&lt;/p&gt;</description>
                <environment></environment>
            <key id="10829">DDC-298</key>
            <summary>Allow Entity to hold a collection of a single primitive type</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="beberlei">Benjamin Eberlei</reporter>
                        <labels>
                    </labels>
                <created>Tue, 2 Feb 2010 22:54:51 +0000</created>
                <updated>Fri, 24 Dec 2010 05:05:59 +0000</updated>
                                    <version>2.1</version>
                                <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>3</votes>
                        <watches>5</watches>
                        <comments>
                    <comment id="11585" author="beberlei" created="Tue, 2 Feb 2010 22:57:00 +0000"  >&lt;p&gt;In this implementation Schema-Tool would generate a table:&lt;/p&gt;

&lt;p&gt;elementTable (entity_id-1, ..., entity_id-n, key, value) and using the Platform Type Generation of keyType and valueType&lt;/p&gt;</comment>
                    <comment id="11586" author="beberlei" created="Tue, 2 Feb 2010 23:04:43 +0000"  >&lt;p&gt;Column Names should be Change-able also since there could be people who name their primary keys &quot;key&quot; and &quot;value&quot; o_O&lt;/p&gt;</comment>
                    <comment id="11587" author="beberlei" created="Tue, 2 Feb 2010 23:05:43 +0000"  >&lt;p&gt;Ordering could be implemented on top of this using the @OrderColumn JPA implementation by adding another column to the table with a numeric order that will be &quot;order by&quot;&apos;d on select time.&lt;/p&gt;</comment>
                    <comment id="15009" author="beberlei" created="Fri, 24 Dec 2010 05:05:59 +0000"  >&lt;p&gt;Pushed back&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-763] Cascade merge on associated entities can insert too many rows through &quot;Persistence by Reachability&quot;</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-763</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I think that the UnitOfWork needs to maintain a map of spl_object_hash($newEntity)-&amp;gt;$managedEntity for entities that were persisted via reachability during a merge.  doMerge should then only call persistNew if the original entity has not already been persisted (if it has already been persisted it should merge the managed entity from the map).  The map should be maintained until a flush() or until the UnitOfWork is cleared.  The reasoning is as follows.&lt;/p&gt;

&lt;p&gt;Imagine we have a simple doctor object with no associations:&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;$doctor = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Doctor();
$em-&amp;gt;persist($doctor);
$em-&amp;gt;persist($doctor);
$em-&amp;gt;flush();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;After the first persist() $doctor is MANAGED so the second persist has no effect and this results in a single Doctor row.&lt;/p&gt;

&lt;p&gt;If we do the same thing using merge and persistence by reachability:&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;$doctor = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Doctor();
$em-&amp;gt;merge($doctor);
$em-&amp;gt;merge($doctor);
$em-&amp;gt;flush();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;we get 2 Doctor rows being added.&lt;/p&gt;

&lt;p&gt;Obviously in this particular case we should use the return value from the first merge() as the parameter of the second merge which would give correct behaviour.&lt;/p&gt;

&lt;p&gt;However, now imagine one Doctor has many Patients and many Patients have one Doctor, all the associations have cascade merge enabled, and further assume that $d1 (Doctor id=1) is already in the database.  We now attempt to create two patients and assign them to the existing doctor:&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;$d1= &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Doctor(); $d1-&amp;gt;id = 1; &lt;span class=&quot;code-comment&quot;&gt;// This is a DETACHED entity
&lt;/span&gt;
$p1 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Patient();
$p2 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Patient();

$d1-&amp;gt;patients-&amp;gt;add($p1); $p1-&amp;gt;doctor = $d1;
$d1-&amp;gt;patients-&amp;gt;add($p2); $p2-&amp;gt;doctor = $d1;

$em-&amp;gt;merge($p1);
$em-&amp;gt;merge($p2);

$em-&amp;gt;flush();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This actually results in 4 rows being added to the &apos;patients&apos; table instead of 2, I think because $p1 and $p2 are getting persisted both as the root objects and then again from the patient-&amp;gt;doctor-&amp;gt;patients array.  Since the cascade merging happens internally we can&apos;t replace the array contents with the managed return values without walking through the object graph (in which case there is no point in using cascade merge in the first place).  Maintaining a map in UnitOfWork will allow doMerge to ensure it doesn&apos;t persist the same entities twice.&lt;/p&gt;

&lt;p&gt;I&apos;m not sure, but this might be relevant for cascade persist too.&lt;/p&gt;

&lt;p&gt;P.S. Another bug report on this can be found at &lt;a href=&quot;http://code.google.com/p/flextrine2/issues/detail?id=32&quot; class=&quot;external-link&quot;&gt;http://code.google.com/p/flextrine2/issues/detail?id=32&lt;/a&gt; (it basically says the same thing with different entities).&lt;/p&gt;</description>
                <environment></environment>
            <key id="11812">DDC-763</key>
            <summary>Cascade merge on associated entities can insert too many rows through &quot;Persistence by Reachability&quot;</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="ccapndave">Dave Keen</reporter>
                        <labels>
                    </labels>
                <created>Mon, 23 Aug 2010 05:55:30 +0000</created>
                <updated>Mon, 4 Jul 2011 21:47:46 +0000</updated>
                                                    <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="14135" author="beberlei" created="Sun, 29 Aug 2010 04:59:05 +0000"  >&lt;p&gt;@Roman A possible fix for this in my opinion is another map in UnitOfWork $mergedEntities = array(); and a patch like 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;diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php
index 242d84b..1d0d8b3 100644
--- a/lib/Doctrine/ORM/UnitOfWork.php
+++ b/lib/Doctrine/ORM/UnitOfWork.php
@@ -1340,6 +1340,10 @@ class UnitOfWork &lt;span class=&quot;code-keyword&quot;&gt;implements&lt;/span&gt; PropertyChangedListener
             &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt;; &lt;span class=&quot;code-comment&quot;&gt;// Prevent infinite recursion
&lt;/span&gt;         }
 
+        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (isset($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;mergedEntities[$oid])) {
+            &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;mergedEntities[$oid];
+        }
+
         $visited[$oid] = $entity; &lt;span class=&quot;code-comment&quot;&gt;// mark visited
&lt;/span&gt; 
         $class = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;em-&amp;gt;getClassMetadata(get_class($entity));
@@ -1468,6 +1472,8 @@ class UnitOfWork &lt;span class=&quot;code-keyword&quot;&gt;implements&lt;/span&gt; PropertyChangedListener
 
         $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;cascadeMerge($entity, $managedCopy, $visited);
 
+        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;mergedEntities[$oid] = $managedCopy;
+
         &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $managedCopy;
     }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="14139" author="ccapndave" created="Sun, 29 Aug 2010 05:38:51 +0000"  >&lt;p&gt;I have tested this patch with my application and it fixes the problem in all my relevant test cases apart from one.  The test case that&apos;s failing is one that persists a bi-directional many to many relationship, so the associations interweave with each other (if you know what I mean).&lt;/p&gt;

&lt;p&gt;I wonder if perhaps doMerge need to continue cascading even if it finds an item in $this-&amp;gt;mergedEntities&lt;/p&gt;

&lt;p&gt;This is the Flextrine code that fails - it results in no entries in movie_artist.  This might also be related to &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-758&quot; title=&quot;When merging many to many entites back into the repository changes to the associations are not respected&quot;&gt;&lt;del&gt;DDC-758&lt;/del&gt;&lt;/a&gt;?&lt;/p&gt;

&lt;p&gt;m1 = new Movie();&lt;br/&gt;
m1.title = &quot;Movie 1&quot;;&lt;/p&gt;

&lt;p&gt;m2 = new Movie();&lt;br/&gt;
m2.title = &quot;Movie 2&quot;;&lt;/p&gt;

&lt;p&gt;a1 = new Artist();&lt;br/&gt;
a1.name = &quot;Artist 1&quot;;&lt;/p&gt;

&lt;p&gt;a2 = new Artist();&lt;br/&gt;
a2.name = &quot;Artist 2&quot;;&lt;/p&gt;

&lt;p&gt;m1.artists.addItem(a1); a1.movies.addItem(m1);&lt;br/&gt;
m1.artists.addItem(a2); a2.movies.addItem(m1);&lt;/p&gt;

&lt;p&gt;m2.artists.addItem(a1); a1.movies.addItem(m2);&lt;br/&gt;
m2.artists.addItem(a2); a2.movies.addItem(m2);&lt;/p&gt;

&lt;p&gt;// These translate to cascade merges on the server &lt;br/&gt;
em.persist(m1);&lt;br/&gt;
em.persist(m2);&lt;br/&gt;
em.persist(a1);&lt;br/&gt;
em.persist(a2);&lt;/p&gt;

&lt;p&gt;// Now flush&lt;br/&gt;
em.flush();&lt;/p&gt;</comment>
                    <comment id="14140" author="ccapndave" created="Sun, 29 Aug 2010 05:40:26 +0000"  >&lt;p&gt;P.S. This test passes if I translate em.persist() to $em-&amp;gt;persist() (not cascading) on the server instead of translating it to a cascade merge; not sure if that helps&lt;/p&gt;</comment>
                    <comment id="14149" author="romanb" created="Mon, 30 Aug 2010 06:17:09 +0000"  >&lt;p&gt;I&apos;d really like to avoid introducing an additional instance variable just to solve this issue but I did not find the time yet to really look into it.&lt;/p&gt;

&lt;p&gt;Does someone have a unit test for this already and can attach it to the issue? &lt;/p&gt;</comment>
                    <comment id="14198" author="romanb" created="Tue, 31 Aug 2010 14:56:58 +0000"  >&lt;p&gt;Rescheduling for RC1.&lt;/p&gt;</comment>
                    <comment id="14356" author="ccapndave" created="Mon, 13 Sep 2010 07:27:17 +0000"  >&lt;p&gt;Here is a functional test case containing three tests:&lt;/p&gt;

&lt;p&gt;testMultiMerge tests basic merging of two new entities, checking that only a single entity ends up in the database.  This passes with Benjamin&apos;s patch.&lt;/p&gt;

&lt;p&gt;testMultiCascadeMerge tests the more complex case of merging a OneToMany association. This also passes with Benjamin&apos;s patch.&lt;/p&gt;

&lt;p&gt;testManyToManyPersistByReachability tests the ManyToMany case described above and this fails with Benjamin&apos;s patch, probably because doMerge doesn&apos;t cascade down entities that it has already merged and some ManyToMany associations are being ignored.  Its a bit hard to be certain what is causing this as even without Benjamin&apos;s patch this test would fail due to &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-758&quot; title=&quot;When merging many to many entites back into the repository changes to the associations are not respected&quot;&gt;&lt;del&gt;DDC-758&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                    <comment id="14397" author="beberlei" created="Wed, 15 Sep 2010 16:38:30 +0000"  >&lt;p&gt;@Roman i thought about this issue, its not possible without that additional map of merged entities. There is no way we can get that information from other sources. &lt;/p&gt;

&lt;p&gt;Problem is rather that the use-case probably only applies in mass-merging scenarios and client-server serialization.&lt;/p&gt;</comment>
                    <comment id="14442" author="ccapndave" created="Tue, 21 Sep 2010 19:48:39 +0000"  >&lt;p&gt;Added another failing test case - adding the same entity from different ends of a many to many bi-directional association to check that there isn&apos;t an integrity constraint violation caused by Doctrine trying to add the same row twice.&lt;/p&gt;</comment>
                    <comment id="14443" author="ccapndave" created="Tue, 21 Sep 2010 20:14:42 +0000"  >&lt;p&gt;Attached a patch for this issue.&lt;/p&gt;</comment>
                    <comment id="14444" author="beberlei" created="Wed, 22 Sep 2010 03:13:36 +0000"  >&lt;p&gt;can you comment why all the additionall stuff is necessary compared to my patch?&lt;/p&gt;</comment>
                    <comment id="14445" author="ccapndave" created="Wed, 22 Sep 2010 06:05:40 +0000"  >&lt;p&gt;It fixes the two additional test cases - testManyToManyPersistByReachability and testManyToManyDuplicatePersistByReachability.&lt;/p&gt;

&lt;p&gt;testManyToManyPersistByReachability was failing with your original patch because there are ManyToMany cases where an entity may have already been merged, but its still necessary to add it to an association and continue to cascade.  Running the following with the original patch will miss out some of the associations.&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;$m1 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Movie();
$m1-&amp;gt;title = &lt;span class=&quot;code-quote&quot;&gt;&quot;Movie 1&quot;&lt;/span&gt;;

$m2 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Movie();
$m2-&amp;gt;title = &lt;span class=&quot;code-quote&quot;&gt;&quot;Movie 2&quot;&lt;/span&gt;;

$a1 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Artist();
$a1-&amp;gt;name = &lt;span class=&quot;code-quote&quot;&gt;&quot;Artist 1&quot;&lt;/span&gt;;

$a2 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Artist();
$a2-&amp;gt;name = &lt;span class=&quot;code-quote&quot;&gt;&quot;Artist 2&quot;&lt;/span&gt;;

$m1-&amp;gt;artists-&amp;gt;add($a1); $a1-&amp;gt;movies-&amp;gt;add($m1);
$m1-&amp;gt;artists-&amp;gt;add($a2); $a2-&amp;gt;movies-&amp;gt;add($m1);
$m2-&amp;gt;artists-&amp;gt;add($a1); $a1-&amp;gt;movies-&amp;gt;add($m2);
$m2-&amp;gt;artists-&amp;gt;add($a2); $a2-&amp;gt;movies-&amp;gt;add($m2);

$em-&amp;gt;merge($a1);
$em-&amp;gt;merge($a2);
$em-&amp;gt;flush();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The other change in my patch is to protect against this case.  It ensures that the following code doesn&apos;t add the same entity twice to a collection.&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;$em-&amp;gt;merge($m1);
$em-&amp;gt;merge($m2);
$em-&amp;gt;merge($a2);
$em-&amp;gt;merge($a2);
$em-&amp;gt;flush();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="14627" author="beberlei" created="Sun, 31 Oct 2010 02:19:03 +0000"  >&lt;p&gt;I am not sure if the issue here is rather multiple calls to merge that contain different parts of the same object-graph.&lt;/p&gt;

&lt;p&gt;There should be a very simple fix for this, call -&amp;gt;clear() after each merge.&lt;/p&gt;

&lt;p&gt;I am not sure if this patch drags us into a blackhole of issues with merging.&lt;/p&gt;</comment>
                    <comment id="14649" author="ccapndave" created="Sun, 31 Oct 2010 08:48:37 +0000"  >&lt;p&gt;Calling -&amp;gt;clear() and -&amp;gt;flush() after each merge is a workaround for the simple case, but unless I am misunderstanding I don&apos;t think its a solution for cases where the merging is happening automatically in cascadeMerge.  I&apos;ve actually encountered this issue in another project and scenario to do with creating REST APIs and merging JSON objects into entities, and applying the patch fixed it so a) I think this issue might be a more common that we first thought and b) the patch basically seems to work (plus it doesn&apos;t introduce any failing cases in the existing test suite).  I can actually still find one edge case to do with cascading merging interlinked many to many associations that this doesn&apos;t fix, but I was planning to open that as a new ticket after this   My feeling is that the current merge already has issues and this definitely improves it.&lt;/p&gt;</comment>
                    <comment id="14652" author="beberlei" created="Mon, 1 Nov 2010 02:45:36 +0000"  >&lt;p&gt;It cannot happen inside a single merge, single merges use the $visited to avoid infinite recursions, each entity can only be merged once inside a single merge operation.&lt;/p&gt;</comment>
                    <comment id="14713" author="beberlei" created="Wed, 10 Nov 2010 17:50:54 +0000"  >&lt;p&gt;Added a note into the documentation about using EntityManager#clear between merging of entities which share subgraphs and cascade merge.&lt;/p&gt;

&lt;p&gt;Handling this issue in UnitOfwork will be declared an improvement, not a bug anymore and be scheduled for later releases. The required changes to the core are to dangerous and big.&lt;/p&gt;</comment>
                    <comment id="14714" author="ccapndave" created="Thu, 11 Nov 2010 03:49:15 +0000"  >&lt;p&gt;Where in the docs is that?&lt;/p&gt;

&lt;p&gt;Just to summarize, the equivalent operation to having multiple merges and a single flush is to call merge followed by flush each time, with the whole thing surrounded by a transaction?  Does this have a big impact on performance?&lt;/p&gt;</comment>
                    <comment id="14715" author="ccapndave" created="Thu, 11 Nov 2010 04:49:18 +0000"  >&lt;p&gt;Ben - even given the decision not to implement this (and I do understand your thinking, as it is a major change), is there any reason not to implement the bit that ensures that the same entity isn&apos;t added to a collection twice during a merge?  I can&apos;t think of a situation where this should be allowed, and I have a use case where I get &apos;DUPLICATE KEY&apos; errors if this isn&apos;t there.&lt;/p&gt;

&lt;p&gt;Please see attached patch.&lt;/p&gt;</comment>
                    <comment id="14716" author="beberlei" created="Thu, 11 Nov 2010 06:35:37 +0000"  >&lt;p&gt;What bit of that huge patch is that? Can you extract it into another ticket if thats possible?&lt;/p&gt;</comment>
                    <comment id="14717" author="beberlei" created="Thu, 11 Nov 2010 06:36:52 +0000"  >&lt;p&gt;I added it to &quot;Working with Objects&quot; and the descripton of Merge. Its not yet live on the site.&lt;/p&gt;

&lt;p&gt;Using this current workaround has a performance impact, since more SELECT statements have to be issued against the database. &lt;/p&gt;</comment>
                    <comment id="14718" author="ccapndave" created="Thu, 11 Nov 2010 08:30:42 +0000"  >&lt;p&gt;Apologies for not being clear - only the 3rd patch (multipleaddmerge.diff) is relevant to the &apos;DUPLICATE KEY&apos; error I am now talking about, but I&apos;ll put it in a nother ticket if you prefer.&lt;/p&gt;</comment>
                    <comment id="14719" author="beberlei" created="Thu, 11 Nov 2010 08:35:47 +0000"  >&lt;p&gt;please add a new ticket, patch looks good.&lt;/p&gt;</comment>
                    <comment id="14720" author="ccapndave" created="Thu, 11 Nov 2010 08:51:11 +0000"  >&lt;p&gt;Created as &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-875&quot; title=&quot;Merge can sometimes add the same entity twice into a collection&quot;&gt;&lt;del&gt;DDC-875&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10812" name="0149-DDC-763.patch" size="16017" author="ccapndave" created="Tue, 21 Sep 2010 20:14:42 +0000" />
                    <attachment id="10811" name="DDC763Test.php" size="6795" author="ccapndave" created="Tue, 21 Sep 2010 19:48:39 +0000" />
                    <attachment id="10858" name="multipleaddmerge.diff" size="1161" author="ccapndave" created="Thu, 11 Nov 2010 04:49:18 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-717] Do not use files when using proxy autogeneration</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-717</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Proxy classes are generated in less than 1ms for me. I prefer to not have a &quot;build&quot; step to reducing loading time by a milisecond, so I use autogenerate.&lt;/p&gt;

&lt;p&gt;For users like me, wouldn&apos;t it be nicer if we wouldn&apos;t even have to configure a proxy dir and those files were never written (since they&apos;re not read more than once anyway)?&lt;/p&gt;</description>
                <environment></environment>
            <key id="11676">DDC-717</key>
            <summary>Do not use files when using proxy autogeneration</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="jakajancar">Jaka Jancar</reporter>
                        <labels>
                    </labels>
                <created>Thu, 22 Jul 2010 17:52:55 +0000</created>
                <updated>Mon, 4 Jul 2011 21:47:47 +0000</updated>
                                                    <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="13668" author="jakajancar" created="Thu, 22 Jul 2010 18:32:00 +0000"  >&lt;p&gt;This very minimal patch removes the use of these temporary files:&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;--- library/Doctrine/ORM/Proxy/ProxyFactory.php	(revision 2)
+++ library/Doctrine/ORM/Proxy/ProxyFactory.php	(working copy)
@@ -78,9 +78,8 @@
         $fqn = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_proxyNamespace . &apos;\\&apos; . $proxyClassName;
 
         &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;_autoGenerate &amp;amp;&amp;amp; ! class_exists($fqn, &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;)) {
-            $fileName = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_proxyDir . DIRECTORY_SEPARATOR . $proxyClassName . &apos;.php&apos;;
-            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_generateProxyClass($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_em-&amp;gt;getClassMetadata($className), $proxyClassName, $fileName, self::$_proxyClassTemplate);
-            require $fileName;
+            $file = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_generateProxyClass($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_em-&amp;gt;getClassMetadata($className), $proxyClassName, &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, self::$_proxyClassTemplate);
+            eval(&apos;?&amp;gt;&apos;.$file);
         }
 
         &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;_em-&amp;gt;getMetadataFactory()-&amp;gt;hasMetadataFor($fqn)) {
@@ -144,6 +143,9 @@
 
         $file = str_replace($placeholders, $replacements, $file);
 
+        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($fileName === &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;)
+            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $file;
+
         file_put_contents($fileName, $file);
     }
 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="13671" author="beberlei" created="Fri, 23 Jul 2010 03:14:30 +0000"  >&lt;p&gt;The proxy dir is used for the &quot;doctrine orm:generate-proxies&quot; command in the case of &quot;autogenerate= false&quot;, so you need to define it anyways.&lt;/p&gt;

&lt;p&gt;You have to use proxies, the option is not for Proxy yes/no. If you have autogenerate=false and doctrine requires a proxy for a use case but can&apos;t find it you will get a fatal error.&lt;/p&gt;</comment>
                    <comment id="13672" author="beberlei" created="Fri, 23 Jul 2010 03:15:54 +0000"  >&lt;p&gt;I just saw the eval() keyword, ieeks &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/wink.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; It could maybe be a convenience option for those that don&apos;t want to use proxy direcotiries, however i am not sure.&lt;/p&gt;</comment>
                    <comment id="13675" author="jakajancar" created="Fri, 23 Jul 2010 03:22:32 +0000"  >&lt;p&gt;eval() is no different than writing code to a file and using require().&lt;/p&gt;

&lt;p&gt;When using runtime-generated proxies, there are no benefits (that I know of) from writing them to a file. The disadvantages are:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;slower because of write disk access&lt;/li&gt;
	&lt;li&gt;has problems with high concurrency, unless special care is taken (&lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-716&quot; title=&quot;Proxy autogeneration fails with concurrent requests&quot;&gt;&lt;del&gt;DDC-716&lt;/del&gt;&lt;/a&gt;)&lt;/li&gt;
	&lt;li&gt;potentially has permission problems if code is executed by different users (e.g. nobody for a daemon and www-data for http)&lt;/li&gt;
	&lt;li&gt;requires setup of a writable directory&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;This is a nicer patch, which makes _generateProxyClass() return a string, just like other _generate* methods:&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;--- library/Doctrine/ORM/Proxy/ProxyFactory.php	(revision 2)
+++ library/Doctrine/ORM/Proxy/ProxyFactory.php	(working copy)
@@ -78,9 +78,8 @@
         $fqn = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_proxyNamespace . &apos;\\&apos; . $proxyClassName;
 
         &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;_autoGenerate &amp;amp;&amp;amp; ! class_exists($fqn, &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;)) {
-            $fileName = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_proxyDir . DIRECTORY_SEPARATOR . $proxyClassName . &apos;.php&apos;;
-            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_generateProxyClass($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_em-&amp;gt;getClassMetadata($className), $proxyClassName, $fileName, self::$_proxyClassTemplate);
-            require $fileName;
+            $code = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_generateProxyClass($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_em-&amp;gt;getClassMetadata($className), $proxyClassName);
+            eval($code);
         }
 
         &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;_em-&amp;gt;getMetadataFactory()-&amp;gt;hasMetadataFor($fqn)) {
@@ -107,19 +106,19 @@
         foreach ($classes as $class) {
             $proxyClassName = str_replace(&apos;\\&apos;, &apos;&apos;, $class-&amp;gt;name) . &apos;Proxy&apos;;
             $proxyFileName = $proxyDir . $proxyClassName . &apos;.php&apos;;
-            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_generateProxyClass($class, $proxyClassName, $proxyFileName, self::$_proxyClassTemplate);
+            $code = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_generateProxyClass($class, $proxyClassName);
+            file_put_contents($proxyFileName, &lt;span class=&quot;code-quote&quot;&gt;&quot;&amp;lt;?php\n&quot;&lt;/span&gt; . $code);
         }
     }
 
     /**
      * Generates a proxy class file.
      *
-     * @param $class
-     * @param $originalClassName
+     * @param ClassMetadata $class
      * @param $proxyClassName
-     * @param $file The path of the file to write to.
+     * @&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; string The code of the generated methods.
      */
-    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; function _generateProxyClass($class, $proxyClassName, $fileName, $file)
+    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; function _generateProxyClass(ClassMetadata $class, $proxyClassName)
     {
         $methods = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_generateMethods($class);
         $sleepImpl = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_generateSleep($class);
@@ -142,9 +141,9 @@
             $methods, $sleepImpl
         );
 
-        $file = str_replace($placeholders, $replacements, $file);
+        $file = str_replace($placeholders, $replacements, self::$_proxyClassTemplate);
 
-        file_put_contents($fileName, $file);
+        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $file;
     }
 
     /**
@@ -244,8 +243,7 @@
 
     /** Proxy class code template */
     &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; $_proxyClassTemplate =
-&apos;&amp;lt;?php
-
+&apos;
 namespace &amp;lt;namespace&amp;gt;;
 
 /**
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="13679" author="beberlei" created="Sat, 24 Jul 2010 06:21:53 +0000"  >&lt;p&gt;Scheduled usage of eval() for 2.1, if the following conditions exist:&lt;/p&gt;

&lt;p&gt;1. Autogenerate is set to TRUE&lt;br/&gt;
2. No Proxy Directory is configured.&lt;/p&gt;</comment>
                    <comment id="13681" author="jakajancar" created="Sat, 24 Jul 2010 06:26:14 +0000"  >&lt;p&gt;Great, this is even better. This way you can have 1) autogenerated in ram-only, 2) autogenerated in files and 3) pregenerated.&lt;/p&gt;

&lt;p&gt;And the minimal amount of config needed to get up and running is reduced, which is always nice.&lt;/p&gt;</comment>
                    <comment id="13682" author="beberlei" created="Sat, 24 Jul 2010 06:34:49 +0000"  >&lt;p&gt;you should know though, eval is dead slow. It generates the necessary proxies on EACH request and that cannot be cached in APC.&lt;/p&gt;</comment>
                    <comment id="13684" author="jakajancar" created="Sat, 24 Jul 2010 06:46:26 +0000"  >&lt;p&gt;It&apos;s no slower than current autogeneration (file_put_contents+require). TBH, I don&apos;t know why anyone would want to use that over eval(), but I don&apos;t mind it being there.&lt;/p&gt;

&lt;p&gt;Pre-generation is, of course, a different thing. Seems like a valid tradeoff to offer: build/a bit of config/better perfomance vs. no build/no config/potentially slower.&lt;/p&gt;</comment>
                    <comment id="13685" author="beberlei" created="Sat, 24 Jul 2010 07:52:39 +0000"  >&lt;p&gt;Yes, that is because file_put_contents + require is a development only strategy. The manual clearly states that autogenerate has to be false in production.&lt;/p&gt;</comment>
                    <comment id="13933" author="romanb" created="Thu, 12 Aug 2010 09:39:12 +0000"  >&lt;p&gt;Using eval() instead of producing and requiring the file in the case of enabled auto-generation of proxy classes sounds like a good improvement for 2.1 to make proxies more transparent during deveopment and for anyone for whom performance is no issue.&lt;/p&gt;

&lt;p&gt;I&apos;m increasing the priority as I think it is easy to implement for 2.1 and a good enhancement.&lt;/p&gt;</comment>
                    <comment id="15243" author="k-fish" created="Wed, 9 Feb 2011 04:09:51 +0000"  >&lt;p&gt;A note on why having the proxies written to a file can be useful even with autogenerate being on: it makes it really easy to check the proxy code being generated. I use that a lot currently.&lt;/p&gt;

&lt;p&gt;The solution suggested, giving three possibilities is cool, though.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<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>

<item>
            <title>[DDC-688] Original Entity Data gets overridden by the change set</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-688</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;When changing data in an entity, the UnitOfWork will call computeChangeSet on a flush event. If there is a changeset, the original data ($this-&amp;gt;_originalEntityData) gets overridden by the new data. However, the _originalEntityData should hold the original data, that was present at the time the entity was reconstituted from the database. This does no longer hold now.&lt;/p&gt;

&lt;p&gt;I think this can simply be fixed by commenting this line, however I do not know of any consequences this may bring with it:&lt;/p&gt;

&lt;p&gt;$this-&amp;gt;_originalEntityData&lt;span class=&quot;error&quot;&gt;&amp;#91;$oid&amp;#93;&lt;/span&gt; = $actualData; (in computeChangeSet, after if( $changeSet ));&lt;/p&gt;

&lt;p&gt;Anyway, I ran into this problem while trying to retrieve the original data at the onFlush event of an update.&lt;/p&gt;</description>
                <environment>Mac OS X 10.6; PHP 5.3.2; MySQL 5.1.44</environment>
            <key id="11618">DDC-688</key>
            <summary>Original Entity Data gets overridden by the change set</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="jasper">Jasper Kuperus</reporter>
                        <labels>
                    </labels>
                <created>Mon, 12 Jul 2010 17:42:36 +0000</created>
                <updated>Tue, 28 Dec 2010 06:38:22 +0000</updated>
                                    <version>2.0-BETA2</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="13855" author="romanb" created="Sun, 8 Aug 2010 09:17:56 +0000"  >&lt;p&gt;This is actually currently expected. You can not get access to the original data in the onFlush event right now. I&apos;m not saying that this will never be possible but it is simply the way it works at the moment.&lt;/p&gt;</comment>
                    <comment id="14937" author="jasper" created="Wed, 8 Dec 2010 18:11:56 +0000"  >&lt;p&gt;Does this mean that it is currently impossible to implement a Versionable mechanism using snapshots?&lt;/p&gt;</comment>
                    <comment id="14938" author="beberlei" created="Thu, 9 Dec 2010 03:44:31 +0000"  >&lt;p&gt;You can hold a map of them yourself if your listener also implements the &quot;postLoad&quot; event:&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;$entity = $args-&amp;gt;getentity();
$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;originalData[spl_object_hash($entity)] = $args-&amp;gt;getEntityManager()-&amp;gt;getUnitOfWork()-&amp;gt;getOriginalData($entity);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="15041" author="beberlei" created="Tue, 28 Dec 2010 06:38:22 +0000"  >&lt;p&gt;Changed into possible improvement for the future&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-683] EntityManager#lock() on unitialized proxy coudl be optimized</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-683</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;If you call lock() on an unitiialized proxy, it would be possible to combine the fetch and lock in one operation. Is this feasible from a technical / workflow perspsective?&lt;/p&gt;</description>
                <environment></environment>
            <key id="11611">DDC-683</key>
            <summary>EntityManager#lock() on unitialized proxy coudl be optimized</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="beberlei">Benjamin Eberlei</reporter>
                        <labels>
                    </labels>
                <created>Sat, 10 Jul 2010 17:57:37 +0000</created>
                <updated>Wed, 21 Jul 2010 17:33:56 +0000</updated>
                                    <version>2.0-BETA2</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="13651" author="beberlei" created="Wed, 21 Jul 2010 17:33:56 +0000"  >&lt;p&gt;Ok this is what refresh() with LOCK support is actually needed for:&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;    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function lock($entity, $lockMode, $lockVersion = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;)
    {
        &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;getEntityState($entity) != self::STATE_MANAGED) {
            &lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; InvalidArgumentException(&lt;span class=&quot;code-quote&quot;&gt;&quot;Entity is not MANAGED.&quot;&lt;/span&gt;);
        } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($entity &lt;span class=&quot;code-keyword&quot;&gt;instanceof&lt;/span&gt; Proxy &amp;amp;&amp;amp; $entity-&amp;gt;__isInitialized__) {
            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;refresh(....); &lt;span class=&quot;code-comment&quot;&gt;// with LOCK!
&lt;/span&gt;        }
        ...
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10001">
                <name>Reference</name>
                                <outwardlinks description="relates to">
                            <issuelink>
            <issuekey id="11609">DDC-681</issuekey>
        </issuelink>
                    </outwardlinks>
                                            </issuelinktype>
                    </issuelinks>
                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-676] Find a way to test serialize/unserialize of all ClassMetadata properties in isolation</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-676</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;We should find a way, using PHPUnit Data Providers or anything else, to check the serialize/unserialize of every property in the ClassMetadata instance, since errors here can be very subtle but dangerous.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11604">DDC-676</key>
            <summary>Find a way to test serialize/unserialize of all ClassMetadata properties in isolation</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="beberlei">Benjamin Eberlei</reporter>
                        <labels>
                    </labels>
                <created>Sat, 10 Jul 2010 05:26:20 +0000</created>
                <updated>Sun, 29 Aug 2010 05:05:50 +0000</updated>
                                                    <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-667] Lock Timeout Query Hint for DQL Queries</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-667</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;After the implementation of &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-178&quot; title=&quot;Query Hint for LOCK mechanisms plus support in $em-&amp;gt;find()&quot;&gt;&lt;del&gt;DDC-178&lt;/del&gt;&lt;/a&gt; there is now only outstanding the support for locking queries based on a given timeout.&lt;/p&gt;

&lt;p&gt;This will be a DQL query feature only and be available via a query hint:&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;$query-&amp;gt;setHint(Query::LOCK_TIMEOUT, $timeoutMs);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It will be only working on Oracle.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11583">DDC-667</key>
            <summary>Lock Timeout Query Hint for DQL Queries</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="beberlei">Benjamin Eberlei</reporter>
                        <labels>
                    </labels>
                <created>Sun, 4 Jul 2010 08:40:43 +0000</created>
                <updated>Thu, 16 Sep 2010 15:20:18 +0000</updated>
                                    <version>2.0-BETA2</version>
                                <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="14157" author="romanb" created="Mon, 30 Aug 2010 06:32:49 +0000"  >&lt;p&gt;If this is to be implemented for 2.0, it needs to happen for RC1, therefore rescheduling to RC1. Feel free to reschedule to 2.x if necessary.&lt;/p&gt;</comment>
                    <comment id="14407" author="beberlei" created="Thu, 16 Sep 2010 15:20:18 +0000"  >&lt;p&gt;Only oracle supports lock timeouts and no other vendor seems to plan to support it. I move to 2.x, but i guess this would rather be an issue of user extension.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-658] Reverse engineering with Oracle (DBDriver and Associations as Identifier)</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-658</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I am playing with reverse engineering with Oracle and I have some problems:&lt;/p&gt;

&lt;p&gt;My schema:&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;drop table PHONE_NUMBER;
drop table CUSTOMER;

create table CUSTOMER (
   CUSTOMER_ID             NUMBER(4)                       not &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;,
   CUSTOMER_LASTNAME       VARCHAR2(50)                    not &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;,
   CUSTOMER_MODIFIED       DATE,
   constraint PK_CUSTOMER primary key (CUSTOMER_ID)
         using index
       tablespace TBS_INDEX
       storage
       (
           initial 100K
           next 100K
       )
)
storage
(
    initial 100K
    next 100K
)
tablespace TBS_DATA;

create table PHONE_NUMBER (
   PHONE_NUMBER_ID         NUMBER(4)                       not &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;,
   CUSTOMER_ID             NUMBER(4)                       not &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;,
   PHONE_NUMBER            VARCHAR2(50)                    not &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;,
   PHONE_NUMBERMODIFIED    DATE,
   constraint PK_PHONE_NUMBER primary key (PHONE_NUMBER_ID, CUSTOMER_ID)
         using index
       tablespace TBS_INDEX
       storage
       (
           initial 100K
           next 100K
       )
)
storage
(
    initial 100K
    next 100K
)
tablespace TBS_DATA;

alter table PHONE_NUMBER
   add constraint PHONE_NUMBER__CUSTOMER foreign key (CUSTOMER_ID)
      references CUSTOMER (CUSTOMER_ID);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I obtain &quot;Fatal error: Uncaught exception &apos;Doctrine\ORM\Mapping\MappingException&apos; with message &apos;Property &quot;customerId&quot; in &quot;PhoneNumber&quot; was already declared, but it must be declared only once&apos;&quot;&lt;/p&gt;

&lt;p&gt;It&apos;s because a foreign key is a component of the primary key.&lt;/p&gt;</description>
                <environment>Ubuntu 10.04 + Oracle 11g Entreprise + PHP 5.3.2 + Doctrine2 Git (up-to-date) </environment>
            <key id="11559">DDC-658</key>
            <summary>Reverse engineering with Oracle (DBDriver and Associations as Identifier)</summary>
                <type id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/subtask_alternate.png">Sub-task</type>
                    <parent id="10344">DDC-117</parent>
                        <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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="mikaelkael">Mickael Perraud</reporter>
                        <labels>
                    </labels>
                <created>Sun, 27 Jun 2010 10:48:25 +0000</created>
                <updated>Sun, 11 Dec 2011 05:39:00 +0000</updated>
                                                    <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="13435" author="mikaelkael" created="Mon, 28 Jun 2010 04:44:25 +0000"  >&lt;p&gt;This is the continuation of &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-616&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DDC-616&lt;/a&gt;. Only the schema is different.&lt;/p&gt;</comment>
                    <comment id="13436" author="beberlei" created="Mon, 28 Jun 2010 04:52:22 +0000"  >&lt;p&gt;just for understanding this scenario:&lt;/p&gt;

&lt;p&gt;Is this a One-To-One relation and the TABLE_TEST2 &quot;inherits&quot; the primary key from its parent TABLE_TEST1?&lt;/p&gt;

&lt;p&gt;If yes, this construct is not yet supported by Doctrine 2, we still need to include an ID-Generator that supports this kind of schema.&lt;/p&gt;</comment>
                    <comment id="13437" author="mikaelkael" created="Mon, 28 Jun 2010 05:42:41 +0000"  >&lt;p&gt;Change for a more understandable use case. Note that it&apos;s not my real use case and that I work on legacy database on which I can&apos;t change the structure.&lt;/p&gt;</comment>
                    <comment id="15083" author="beberlei" created="Sat, 1 Jan 2011 15:50:02 +0000"  >&lt;p&gt;updated the issue topic to get a better grasp of what needs to be done here.&lt;/p&gt;</comment>
                    <comment id="15966" author="waldo2188" created="Thu, 9 Jun 2011 14:26:50 +0000"  >&lt;p&gt;I have the same error with Mysql whit the same condition.&lt;/p&gt;</comment>
                    <comment id="16923" author="beberlei" created="Mon, 28 Nov 2011 12:11:09 +0000"  >&lt;p&gt;More details on the work to be done:&lt;/p&gt;

&lt;p&gt;The relevant code is in Doctrine/ORM/Mapping/Driver/DatabaseDriver.php only.&lt;/p&gt;

&lt;p&gt;The idea is currently many-to-many tables are detected by checking that the table has foreign keys on all the primary key columns (no additional columns!)&lt;/p&gt;

&lt;p&gt;Now with the 2.1 feature of foreign key/primary key entities this is not necessarily true anymore. You can have the primary keys being foreign keys BUT have additional columns that are not part of the primary key. This has to be detected.&lt;/p&gt;

&lt;p&gt;If a foreign key-primary-key entity is found that has additional columns a ClassMetadata has to be created and the associations have to be created with the &quot;id&quot; =&amp;gt; true flag in mapManyToOne().&lt;/p&gt;</comment>
                    <comment id="16962" author="scott459" created="Sun, 11 Dec 2011 05:39:00 +0000"  >&lt;p&gt;For what it&apos;s worth, I&apos;m getting this error when I have a PK that is a single column and not a FK.&lt;/p&gt;

&lt;p&gt;  PRIMARY KEY (`id`),&lt;br/&gt;
  UNIQUE KEY `cycle_station_id` (`cycle`,`station_id`),&lt;br/&gt;
  KEY `station_id_idx` (`station_id`),&lt;br/&gt;
  KEY `readings` (`readings`),&lt;br/&gt;
  KEY `source` (`source`),&lt;br/&gt;
  KEY `temperature_min_max` (`temperature_max`,`temperature_min`),&lt;br/&gt;
  KEY `station_id_cycle` (`station_id`,`cycle`,`updated_at`),&lt;br/&gt;
  CONSTRAINT `compiled_1_station_id_stations_id` FOREIGN KEY (`station_id`) REFERENCES `stations` (`id`),&lt;br/&gt;
  CONSTRAINT `compiled_1_station_id_stations_id_1` FOREIGN KEY (`station_id`) REFERENCES `stations` (`id`) ON DELETE CASCADE&lt;br/&gt;
) ENGINE=InnoDB AUTO_INCREMENT=160833690 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-138] Allow for mixed inheritance mapping</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-138</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Requesting implementation of mixed inheritance mapping (class table inheritance and single table inheritance).&lt;/p&gt;

&lt;p&gt;This would be especially handy when the difference between certain classes is only &quot;implementational&quot; (i.e. a subclass only functions differently/implements abstract methods and does not specify any additional fields). Using class table inheritance would result in tables only containing an id column.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10399">DDC-138</key>
            <summary>Allow for mixed inheritance mapping</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="reinier.kip">Reinier Kip</reporter>
                        <labels>
                    </labels>
                <created>Thu, 12 Nov 2009 15:55:19 +0000</created>
                <updated>Fri, 24 Dec 2010 04:54:34 +0000</updated>
                                                                    <component>DQL</component>
                <component>Mapping Drivers</component>
                <component>ORM</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>1</watches>
                            <issuelinks>
                        <issuelinktype id="10000">
                <name>Duplicate</name>
                                                <inwardlinks description="is duplicated by">
                            <issuelink>
            <issuekey id="10756">DDC-265</issuekey>
        </issuelink>
                    </inwardlinks>
                            </issuelinktype>
                    </issuelinks>
                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2337] Allow an entity to use its own persister to take advantage of DB level features if necessary</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2337</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I have a situation where I wanted a single table to use INSERT DELAYED. Its an audit log table where I expect each http request to generate many inserts for. In an effort to not over tax the system I implemented a custom Entity Persister so that it would work. This obviously doesn&apos;t work with all mapping drivers. However if this is a feature that you think is worth integrating I will fork it on github and complete the implementation alongside any changes/improvements requested...&lt;/p&gt;</description>
                <environment></environment>
            <key id="14672">DDC-2337</key>
            <summary>Allow an entity to use its own persister to take advantage of DB level features if necessary</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="gnat">Nathanael Noblet</reporter>
                        <labels>
                    </labels>
                <created>Wed, 6 Mar 2013 20:17:54 +0000</created>
                <updated>Wed, 6 Mar 2013 20:17:54 +0000</updated>
                                                                    <component>Mapping Drivers</component>
                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                    <attachment id="11511" name="persister.patch" size="4366" author="gnat" created="Wed, 6 Mar 2013 20:17:54 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2363] Duplicated record with orphanRemoval and proxy</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2363</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;There is a problem that causes duplicate records are created when EntityManager has to remove an entity due to orphanRemoval. The problem occurs only with a double flush and referred object is a proxy.&lt;/p&gt;

&lt;p&gt;I&apos;m trying to submit a pull request for this ticket. Please, stand by.&lt;/p&gt;</description>
                <environment>Tested both Mac OS X and Ubuntu</environment>
            <key id="14713">DDC-2363</key>
            <summary>Duplicated record with orphanRemoval and proxy</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="mmenozzi">Manuele Menozzi</reporter>
                        <labels>
                        <label>orphanRemoval</label>
                        <label>proxy</label>
                    </labels>
                <created>Fri, 22 Mar 2013 15:07:11 +0000</created>
                <updated>Fri, 22 Mar 2013 15:07:11 +0000</updated>
                                    <version>2.3.2</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2061] Matching Criteria on a PersistentCollection only works on OneToMany associations</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2061</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;What is needed to make it also work for ManyToMany associations?&lt;/p&gt;

&lt;p&gt;May be a better fallback would be do an ArrayCollection-&amp;gt;matching() instead of just giving a runtime exception?&lt;/p&gt;

&lt;p&gt;Is this something that is difficult to implement?&lt;/p&gt;</description>
                <environment></environment>
            <key id="14107">DDC-2061</key>
            <summary>Matching Criteria on a PersistentCollection only works on OneToMany associations</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="terjeb">Terje Br&#229;ten</reporter>
                        <labels>
                        <label>criteria</label>
                        <label>matching</label>
                    </labels>
                <created>Mon, 8 Oct 2012 20:30:35 +0000</created>
                <updated>Mon, 8 Oct 2012 20:32:21 +0000</updated>
                                    <version>Git Master</version>
                                <fixVersion>Git Master</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-668] add upsert support</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-668</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Didnt find anything in the docs on this. Is D2 capable of doing an UPSERT &lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt; in case I am trying to persist an object that may or may not have been saved previously. Different RDBMS support different syntax for this case. Like MySQL has INSERT .. ON DUPLICATE KEY UPDATE (or even INSERT IGNORE) while the SQL standard defines a MERGE syntax which seems to be gaining support. Of course you can always fallback to a SELECT FOR UPDATE (or if you want to be hacky an INSERT which catches duplicate key violations .. but probably not a good idea since many RDBMS rollback on a failure inside a transaction).&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt; &lt;a href=&quot;http://en.wikipedia.org/wiki/Upsert&quot; class=&quot;external-link&quot;&gt;http://en.wikipedia.org/wiki/Upsert&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;See also &lt;a href=&quot;http://opensource.atlassian.com/projects/hibernate/browse/HHH-3011&quot; class=&quot;external-link&quot;&gt;http://opensource.atlassian.com/projects/hibernate/browse/HHH-3011&lt;/a&gt; asking for MERGE support&lt;/p&gt;

&lt;p&gt;Ideally there would be a way to define on a model or model instance level if merge logic should be applied.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11585">DDC-668</key>
            <summary>add upsert support</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="lsmith">Lukas Kahwe</reporter>
                        <labels>
                    </labels>
                <created>Sun, 4 Jul 2010 17:20:19 +0000</created>
                <updated>Tue, 20 Dec 2011 22:22:01 +0000</updated>
                                                    <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>4</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="13543" author="robertb" created="Fri, 9 Jul 2010 01:16:50 +0000"  >&lt;p&gt;Doctrine_Record defines a replace() method. &lt;/p&gt;

&lt;p&gt;In the MySQL Doctrine implementation, however, it is not the same as INSERT .. ON DUPLICATE KEY UPDATE. The replace() method implemented in Doctrine_Connection_Mysql uses the REPLACE INTO syntax, which is a DELETE and then INSERT when the key exists. This is fine, except for tables that use auto-increment fields. The delete-then-insert operation yields a new auto-incremented value, whereas INSERT .. ON DUPLICTATE KEY UPDATE would not.&lt;/p&gt;</comment>
                    <comment id="13544" author="lsmith" created="Fri, 9 Jul 2010 02:34:53 +0000"  >&lt;p&gt;MySQL (and SQLite) REPLACE is a no go. It causes way too much disc I/O and worse yet totally screws up the on disk data structures because of the deleting.&lt;/p&gt;</comment>
                    <comment id="16238" author="beberlei" created="Sun, 31 Jul 2011 08:48:13 +0000"  >&lt;p&gt;Scheduled for 2.2&lt;/p&gt;</comment>
                    <comment id="16239" author="beberlei" created="Sun, 31 Jul 2011 09:09:56 +0000"  >&lt;p&gt;Evaluating this makes me sad, except MySQL support for this is rather non-existant, and the oracle merge is aiming at batch operations.&lt;/p&gt;</comment>
                    <comment id="16681" author="beberlei" created="Sat, 22 Oct 2011 11:08:32 +0000"  >&lt;p&gt;Should this be done with&lt;/p&gt;

&lt;p&gt;1. Select first, then insert&lt;br/&gt;
2. Catch and evaluate exception then update&lt;/p&gt;

&lt;p&gt;I am leaning towards 1.&lt;/p&gt;</comment>
                    <comment id="17074" author="guilhermeblanco" created="Tue, 20 Dec 2011 22:22:01 +0000"  >&lt;p&gt;Updating fix version&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-93] It would be nice if we could have support for ValueObjects</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-93</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&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 User {
	/**
	 * @Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;string&quot;&lt;/span&gt;)
	 */
	&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $address;
	
	/**
	 * @Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;string&quot;&lt;/span&gt;)
	 */
	&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $city;
	
	/**
	 * @Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;string&quot;&lt;/span&gt;)
	 */
	&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $state;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We could have:&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 User {
	/**
	 * @Component(class=&lt;span class=&quot;code-quote&quot;&gt;&quot;Address&quot;&lt;/span&gt;)
	 */
	 &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $address;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It would my life a lot easier....&lt;/p&gt;

&lt;hr /&gt;

&lt;h2&gt;&lt;a name=&quot;Notesforimplementation&quot;&gt;&lt;/a&gt;Notes for implementation&lt;/h2&gt;

&lt;p&gt;Value objects can come in two forms: &lt;/p&gt;

&lt;p&gt;a) as embedded value objects&lt;br/&gt;
b) as collections of value objects&lt;/p&gt;

&lt;p&gt;An implementation should concentrate on a) first. The following things all concentrate on a).&lt;/p&gt;

&lt;h3&gt;&lt;a name=&quot;DQLSupport&quot;&gt;&lt;/a&gt;DQL Support&lt;/h3&gt;

&lt;p&gt;&lt;b&gt;Conditions:&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;1. &quot;select f from Foo f where f.embedded.value = ?1&quot; (setParameter(1, $scalarValue))&lt;br/&gt;
2. &quot;select f from Foo f where f.embedded = ?1&quot; (setParameter(1, $embeddedValueObject))&lt;/p&gt;

&lt;p&gt;At least Nr.1 &lt;b&gt;must&lt;/b&gt; be possible in a first implementation.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Selecting:&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;1. &quot;select f from Foo f&quot; must explode embedded value objects in the SQL SELECT clause.&lt;br/&gt;
2. &quot;select f.embedded from Foo f&quot; must explode the columns of the embedded object in the SQL SELECT clause.&lt;/p&gt;

&lt;p&gt;At least Nr. 1 &lt;b&gt;must&lt;/b&gt; be possible in a first implementation, obviously.&lt;/p&gt;

&lt;p&gt;Components affected (among others): Parser, SqlWalker, ...&lt;/p&gt;


&lt;h3&gt;&lt;a name=&quot;Persisters&quot;&gt;&lt;/a&gt;Persisters&lt;/h3&gt;

&lt;p&gt;The persisters need to take embedded value objects into account when persisting as well as loading entities.&lt;/p&gt;

&lt;p&gt;Components affected (among others): Persisters, UnitOfWork, ...&lt;/p&gt;


&lt;h3&gt;&lt;a name=&quot;Metadata&quot;&gt;&lt;/a&gt;Metadata&lt;/h3&gt;

&lt;p&gt;ClassMetadataInfo needs to be extended with a field (probably an array) that contains the mappings of embedded values.&lt;br/&gt;
New annotations as well as XML/YAML elements are needed.&lt;/p&gt;

&lt;p&gt;Components affected (among others): ClassMetadataInfo, AnnotationDriver, YamlDriver, XmlDriver, doctrine-mapping.xsd, ...&lt;/p&gt;


&lt;h3&gt;&lt;a name=&quot;ChangeTracking&quot;&gt;&lt;/a&gt;Change Tracking&lt;/h3&gt;

&lt;p&gt;If value objects are supposed to be immutable this is easy and might require no or few changes. If, however, we want to track changes in mutable value objects it might get more complicated.&lt;/p&gt;

&lt;p&gt;Components affected (among others): UnitOfWork, ...&lt;/p&gt;

</description>
                <environment></environment>
            <key id="10295">DDC-93</key>
            <summary>It would be nice if we could have support for ValueObjects</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="guilhermeblanco">Guilherme Blanco</assignee>
                                <reporter username="ablock">Avi Block</reporter>
                        <labels>
                    </labels>
                <created>Sun, 1 Nov 2009 14:27:35 +0000</created>
                <updated>Sun, 14 Apr 2013 10:18:46 +0000</updated>
                                                    <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>37</votes>
                        <watches>31</watches>
                        <comments>
                    <comment id="10511" author="beberlei" created="Thu, 5 Nov 2009 13:06:26 +0000"  >&lt;p&gt;formated snippets nicely&lt;/p&gt;</comment>
                    <comment id="11150" author="trashofmasters" created="Wed, 9 Dec 2009 17:59:53 +0000"  >&lt;p&gt;I need this feature too.&lt;/p&gt;

&lt;p&gt;But I would suggest using the same annotation used by JPA&lt;/p&gt;

&lt;p&gt;@Embeddable&lt;/p&gt;

&lt;p&gt;+1&lt;/p&gt;</comment>
                    <comment id="11215" author="alan" created="Thu, 17 Dec 2009 19:07:36 +0000"  >&lt;p&gt;You should also take into consideration different storage strategies of ValueObjects.&lt;/p&gt;

&lt;p&gt;Martin Fowler points out -  in &#8222;PoEAA&quot;  - two approaches: &lt;a href=&quot;http://martinfowler.com/eaaCatalog/embeddedValue.html&quot; class=&quot;external-link&quot;&gt;Embedded Value (which is the one presented above)&lt;/a&gt; and &lt;a href=&quot;http://martinfowler.com/eaaCatalog/serializedLOB.html&quot; class=&quot;external-link&quot;&gt;Serialized LOB&lt;/a&gt; .&lt;br/&gt;
Both have their pros and cons, that&apos;s why Doctrine2 should give developers choice of selecting the fittest solution.&lt;/p&gt;</comment>
                    <comment id="11216" author="ablock" created="Thu, 17 Dec 2009 19:09:27 +0000"  >&lt;p&gt;Of course technically we can similate a serialized LOB with a new Doctrine 2 type.&lt;/p&gt;</comment>
                    <comment id="11217" author="alan" created="Thu, 17 Dec 2009 19:44:31 +0000"  >&lt;p&gt;I don&apos;t like that idea - Its so not generic.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;VO as a pattern&lt;/b&gt; is important building block of &lt;em&gt;domain model&lt;/em&gt;, which clearly indicates that &lt;b&gt;VO as a feature of Doctrine2&lt;/b&gt; should be tailor-made.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;To anyone of dev-team reading this issue: without VOs Doctrine is not yet DDD-ready, please hurry &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;
</comment>
                    <comment id="11230" author="romanb" created="Fri, 18 Dec 2009 13:58:19 +0000"  >&lt;p&gt;Serialized LOB is not very useful IMHO and has lots of problems (many mentioned in PoEEA already).&lt;/p&gt;

&lt;p&gt;@Alan: I appreciate your nice reminder and I&apos;m sure you mean it in a friendly way, but please keep in mind that noone is paid to work on this project. It all happens in free/spare time and the current state of the project already consumed at least 1 1/2 years spending many hours weekly on this project from me alone. Not to speak of the others.&lt;/p&gt;

&lt;p&gt;Thus, there is no point in demanding something or telling us to hurry. The best way to get a feature in is to provide a (&lt;b&gt;good&lt;/b&gt;) patch that we find worth including.&lt;/p&gt;

&lt;p&gt;I started to add notes to this issue to collect all the things that need to be done for this feature.&lt;/p&gt;

&lt;p&gt;In the meantime, its not too hard/ugly to get a half-way decent embedded value yourself:&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;/** @Entity @HasLifecycleCallbacks */
class Foo {
    &lt;span class=&quot;code-comment&quot;&gt;// annotations not shown
&lt;/span&gt;    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $id;
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $embedded;
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $value1; &lt;span class=&quot;code-comment&quot;&gt;// never reveal to &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt;
&lt;/span&gt;    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $value2; &lt;span class=&quot;code-comment&quot;&gt;// never reveal to &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt;
&lt;/span&gt;    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $value3; &lt;span class=&quot;code-comment&quot;&gt;// never reveal to &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt;
&lt;/span&gt;
   &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getEmbedded() {
       &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;embedded;
   }

   &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setEmbedded($embedded) {
       $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;embedded = $embedded;
   }
   
   /** @PrePersist @PreUpdate */
   function _destructEmbedded() {
       &lt;span class=&quot;code-comment&quot;&gt;// destruct $embedded into $value1, $value2, $value3
&lt;/span&gt;   }

   /** @PostLoad */
   function _constructEmbedded() {
      &lt;span class=&quot;code-comment&quot;&gt;// construct $embedded from $value1, $value2, $value3 
&lt;/span&gt;   }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Several variations of this are possible, also with an external event listener instead of callbacks but in that case you might need to use reflection to get at the values.&lt;/p&gt;</comment>
                    <comment id="11295" author="alan" created="Fri, 25 Dec 2009 12:10:42 +0000"  >&lt;p&gt;I want to share my thoughts on possible VOs collections implementations.&lt;/p&gt;

&lt;p&gt;1. As it was mentioned earlier &lt;em&gt;serialized (C)LOB&lt;/em&gt; is one solution. Implementation of storing/retrieving object graphs alone is quite simple, but it&apos;s complex in terms of SELECTs with conditions.&lt;br/&gt;
Composing SQL condition would result in some nasty constructions e.g. &lt;tt&gt;vo_collection_column LIKE &apos;%foo%bar%&apos;&lt;/tt&gt; which output format would depend on serialization target (CSV, XML, YAML, PHP serialized objects etc.). Also in most cases it would be impossible to obtain eligible result.&lt;/p&gt;

&lt;p&gt;I&apos;m not taking Regexp or XPath operators into consideration as only few RDBMS support them.&lt;/p&gt;

&lt;p&gt;2. The second solution is to break VOs graph into separate related table... or tables if we consider that &lt;b&gt;VO can contain another VO(s)&lt;/b&gt;. It&apos;s not so fast as &lt;em&gt;serialized LOB&lt;/em&gt; but more flexible and it utilize power of RDMS,&lt;br/&gt;
But there is one catch: Doctrine2 must preserve nature of VO. To make it happen during Entities persisting - if any change in dependant VOs graph has been made - all associated VOs rows in database should be deleted and the new/changed VOs graph should be inserted in their place.&lt;br/&gt;
I know it could be inefficient while dealing with large object graphs, yet faster than comparing VOs one-by-one.&lt;/p&gt;

&lt;p&gt;In conclusion:&lt;br/&gt;
&lt;em&gt;serialized LOB&lt;/em&gt; is extremely fast in CRUD-like operations on aggregates, however very search unfriendly.  &lt;br/&gt;
Separate ValueObjects tables are better where  &lt;em&gt;serialized LOB&lt;/em&gt; lacks, but slower in exploitation.&lt;/p&gt;

&lt;p&gt;I can&apos;t tell which approach is superior, because each of them is valid under different circumstances.&lt;/p&gt;

&lt;p&gt;Hope this helps.&lt;/p&gt;

&lt;p&gt;&lt;cite&gt;@Alan: I appreciate your nice reminder and I&apos;m sure you mean it in a friendly way  &lt;span class=&quot;error&quot;&gt;&amp;#91;...&amp;#93;&lt;/span&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;Of course I do.&lt;/p&gt;</comment>
                    <comment id="12131" author="beberlei" created="Sat, 13 Mar 2010 06:20:04 +0000"  >&lt;p&gt;It would be easy to implement value objects in userland using the XML capabilities of many RDBMS:&lt;/p&gt;

&lt;p&gt;1. Implement an Xpath function on the Dql Parser&lt;br/&gt;
2. Implement a User-Defined Type for each value object that handles the translation from and to XML.&lt;/p&gt;

&lt;p&gt;The second point can be heavily optimized when value objects are immutable with an own identiy map of value types inside the Type flyweight instance.&lt;/p&gt;</comment>
                    <comment id="12139" author="ablock" created="Sat, 13 Mar 2010 19:54:54 +0000"  >&lt;p&gt;I more or less suggested something similar above.&lt;/p&gt;</comment>
                    <comment id="12141" author="beberlei" created="Sun, 14 Mar 2010 04:47:41 +0000"  >&lt;p&gt;ah, my bad - i must have overseen this &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                    <comment id="12978" author="jkleijn" created="Sun, 16 May 2010 11:50:31 +0000"  >&lt;p&gt;+1&lt;/p&gt;

&lt;p&gt;This would be awesome.&lt;/p&gt;</comment>
                    <comment id="14689" author="mpdude" created="Tue, 9 Nov 2010 05:48:24 +0000"  >&lt;p&gt;Don&apos;t forget (especially with regard to SLOBs) that values might in turn contain references to Entities.&lt;/p&gt;

&lt;p&gt;Example: An &quot;Order&quot; might be an @Entity and might have a field (an array) of OrderLineItems as value. Each OrderLineItem might e. g. carry quantity or disconunt and references a Product (@Entity).&lt;/p&gt;

&lt;p&gt;So even if you don&apos;t need the traversal from Product to all the Orders it is contained in, serializing the OrderLineItems needs a way to &quot;cut off&quot; the object graph at the transition towards the Product &lt;b&gt;but&lt;/b&gt; must place some kind of referral there so that upon unserialization (of the OrderLineItem list, that is, during Order load) the Product references in every OrderLineItem are at least initialized with proxies again.&lt;/p&gt;

&lt;p&gt;Don&apos;t know whether/how referential integrity (OrderLineItems &amp;lt;-&amp;gt; Products) would make sense or could be implemented here.&lt;/p&gt;</comment>
                    <comment id="15002" author="beberlei" created="Fri, 24 Dec 2010 04:24:27 +0000"  >&lt;p&gt;Pushed back to 2.x, this feature is probably the largest feature request we have and we&apos;d rather focus on small improvements for 2.1&lt;/p&gt;</comment>
                    <comment id="15124" author="zampano" created="Tue, 11 Jan 2011 10:45:33 +0000"  >&lt;p&gt;Several thinks to consider/not to oversee here:&lt;/p&gt;

&lt;p&gt;1) There are value objects with identity. I know that is not DDD-conform but only at first sight. It means they are technically entities but are treated like VOs.&lt;br/&gt;
Common examples are Zipcode or country. As they have identity (e.g. Zipcode: de-40723) they are entities but are created and interchanged like normal VOs.&lt;br/&gt;
On the google DDD-List they were often referenced aS Lookup Entities.&lt;/p&gt;


&lt;p&gt;2) In virtually all (business) cases a collection of VO is an Entity. How else could you reference (add or remove) single elements of that list?&lt;br/&gt;
There are exceptions here like a undefinded number of VOs in a collection, but in that case you can only add or remove a quantity of it.&lt;br/&gt;
As a true collection (say 3 addresses for a client = Entity ClientAdresses) you would have to give them some kind of identity, even if it is only having &lt;br/&gt;
a sequential number in that collection.&lt;/p&gt;

&lt;p&gt;@Matthias: OrderLineItems is an example of actually being an Entity.&lt;/p&gt;</comment>
                    <comment id="15906" author="else" created="Fri, 3 Jun 2011 19:17:58 +0000"  >&lt;p&gt;Hi guys. I face this in my own way. Hope you won&apos;t wake up your neighbours with loud laugh.&lt;/p&gt;

&lt;p&gt;Every @Entity extends my BaseEntity object which provide kind of wrap for value with ValueBase object. So when want to get/set value from entity you call $entity-&amp;gt;getData() where you won&apos;t get value  &quot;data&quot; but wrapping ValueBase for value &quot;data&quot;. Then you can get bare value by getValue(). Name of value class is in annotation and would be child of ValueBase. &lt;/p&gt;

&lt;p&gt;There&apos;s also parent class Base for EntityBase and ValueBase. In my case class Base is something like HTML element. So in the end you can use $entity-&amp;gt;renderHtml() or $value-&amp;gt;renderHtml() no matter if you&apos;re rendering value or @Entity. There&apos;s more features like validation, filtering and hydration value/entity from HTML forms, but it&apos;s extra.&lt;/p&gt;

&lt;p&gt;Implementation:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;&quot;Base.php&quot;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt; 
 /* @MappedSuperclass */
&lt;span class=&quot;code-keyword&quot;&gt;abstract&lt;/span&gt; class Base {
  /* there&apos;re methods like _getParent(), _getPropertyName(), etc. used in code behind */
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;


&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;&quot;ValueBase.php&quot;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt; 
&lt;span class=&quot;code-keyword&quot;&gt;abstract&lt;/span&gt; class ValueBase &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Base { 
   &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getValue() {
        &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;_getParent()-&amp;gt;{$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_getPropertyName()};
   }
   
   &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setValue($value) {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_getParent()-&amp;gt;{$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_getPropertyName()} = $value;
   }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;&quot;EntityBase.php&quot;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt; 
/** @MappedSuperclass */
&lt;span class=&quot;code-keyword&quot;&gt;abstract&lt;/span&gt; class EntityBase &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Base {
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function __call($name, $arguments) {
        /* get property object */
        $pattern = &apos;/^get(.*)$/u&apos;;
        preg_match($pattern, $name, $matches);
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (isset($matches[1])) {
            $propertyName = lcfirst($matches[1]);
            &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;get($propertyName);
        }

        /* set entity */
        $pattern = &apos;/^set(.*)$/u&apos;;
        preg_match($pattern, $name, $matches);
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (isset($matches[1])) {
            $propertyName = lcfirst($matches[1]);
            &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;set($propertyName, $arguments[0]);
        }
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function get($propertyName) {
	    $property = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_getElementProperty($propertyName);

	    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($property == &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;)
		&lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Exception(sprintf(&lt;span class=&quot;code-quote&quot;&gt;&quot;There isn&apos;t property like &apos;%s&apos;.&quot;&lt;/span&gt;, $propertyName));

	    /* &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; collections and entities */
	    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($property[&lt;span class=&quot;code-quote&quot;&gt;&quot;type&quot;&lt;/span&gt;] == &lt;span class=&quot;code-quote&quot;&gt;&quot;collection&quot;&lt;/span&gt; || $property[&lt;span class=&quot;code-quote&quot;&gt;&quot;type&quot;&lt;/span&gt;] == &lt;span class=&quot;code-quote&quot;&gt;&quot;entity&quot;&lt;/span&gt;) {
		$element = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;{$propertyName};
		&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($element != &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;) {
		    $element-&amp;gt;_setParent($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;);
		    $element-&amp;gt;_setPropertyName($propertyName);
		} elseif ($property[&lt;span class=&quot;code-quote&quot;&gt;&quot;type&quot;&lt;/span&gt;] == &lt;span class=&quot;code-quote&quot;&gt;&quot;entity&quot;&lt;/span&gt;) {
		    $element = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; $property[&lt;span class=&quot;code-quote&quot;&gt;&quot;class&quot;&lt;/span&gt;];
		    $element-&amp;gt;_setParent($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;);
		    $element-&amp;gt;_setPropertyName($propertyName);
		    $element-&amp;gt;_setNullEntity();
		    $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;{$propertyName} = $element;
		}
		&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $element;
	    }
	    &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
	    /* &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; values */
		&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!isset($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_loadedEntities[$propertyName])) {
		    $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_loadedEntities[$propertyName] = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; $property[&lt;span class=&quot;code-quote&quot;&gt;&quot;class&quot;&lt;/span&gt;]($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;, $propertyName);
		}
		&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;_loadedEntities[$propertyName];
	    }
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function set($propertyName, $value) {
        $property = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_getElementProperty($propertyName);

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($property == &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;)
            &lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Exception(sprintf(&lt;span class=&quot;code-quote&quot;&gt;&quot;There isn&apos;t property like &apos;%s&apos;.&quot;&lt;/span&gt;, $propertyName));

        /* &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; collections and entities */
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($property[&lt;span class=&quot;code-quote&quot;&gt;&quot;type&quot;&lt;/span&gt;] == &lt;span class=&quot;code-quote&quot;&gt;&quot;collection&quot;&lt;/span&gt; || $property[&lt;span class=&quot;code-quote&quot;&gt;&quot;type&quot;&lt;/span&gt;] == &lt;span class=&quot;code-quote&quot;&gt;&quot;entity&quot;&lt;/span&gt;) {
            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;{$propertyName} = $value;
        }
        /* &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; values */ &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
            &lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Exception(sprintf(&lt;span class=&quot;code-quote&quot;&gt;&quot;Can&apos;t call set on value property &apos;%s&apos;.&quot;&lt;/span&gt;, $propertyName));
        }

        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;;
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Note that there&apos;s something i call &quot;NullEntity&quot;. Instead of getting bare &quot;null&quot; you&apos;ll get @Entity child of EntityBase, where is set property nullEntity. Then there&apos;s posibility to work with null entity (for example renderHtml with empty inputs).&lt;/p&gt;

&lt;p&gt;It would be nice, if this is support by Doctrine natively, because i have some performace problems with my implementation. If it&apos;s interest in my whole code i can send you. But of course there&apos;s some security holes so i&apos;ll send it privetely. Thanks for understand and for Doctrine of course.&lt;/p&gt;</comment>
                    <comment id="16166" author="mathiasverraes" created="Wed, 13 Jul 2011 06:22:23 +0000"  >&lt;p&gt;Note that Roman&apos;s workaround presented here does not work.&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;   /** @PrePersist @PreUpdate */
   function _destructEmbedded() {
       &lt;span class=&quot;code-comment&quot;&gt;// destruct $embedded into $value1, $value2, $value3
&lt;/span&gt;   }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Doctrine tracks changes and does not perform updates when no changes are found. $embedded is not mapped, so it&apos;s not tracked and won&apos;t be taken into account by Doctrine when updating. Therefore, if $embedded is the only value that was changed, the PreUpdate event won&apos;t be triggered.&lt;/p&gt;

&lt;p&gt;The easiest thing to do is to simply destruct the VO on every mutation:&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;   &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setEmbedded($embedded) {
       $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;embedded = $embedded;
       $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_destructEmbedded();
   }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The downside is that you need to remember to call the method in every setter, but apart from that, there are no side effects, it always works and it&apos;s just one line of code &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;_constructEmbedded() keeps working as is, postLoad will always be triggered.&lt;/p&gt;</comment>
                    <comment id="17022" author="dbenjamin" created="Sun, 18 Dec 2011 10:45:26 +0000"  >&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;This feature would be awesome ! &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;br/&gt;
VOs are really essential in a good domain design.&lt;/p&gt;

&lt;p&gt;If you plan to implement this, please remember that you can have nested VOs.&lt;br/&gt;
Take the design for a Booking process for instance, you would have a DateRange object embedding two DateTime objects (in the simplest case).&lt;/p&gt;

&lt;p&gt;I have no doubts that you&apos;ve already took this in consideration, but i prefer pointing this out, just in case &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;


</comment>
                    <comment id="17311" author="beberlei" created="Fri, 20 Jan 2012 16:34:06 +0000"  >&lt;p&gt;work has been started, &lt;a href=&quot;https://github.com/doctrine/doctrine2/pull/265&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/pull/265&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="19036" author="mpdude" created="Fri, 23 Nov 2012 08:36:53 +0000"  >&lt;p&gt;Does the new &quot;complex sql types&quot; feature help here - I mean, could that be used to map a value object to more than one column in the database?&lt;/p&gt;</comment>
                    <comment id="19520" author="songoko20000" created="Sun, 10 Feb 2013 11:52:55 +0000"  >&lt;p&gt;@Benjamin Eberlei The request seems to be closed in the link you provided! Does that mean that this feature won&apos;t be implemented?!&lt;/p&gt;</comment>
                    <comment id="19524" author="ocramius" created="Sun, 10 Feb 2013 18:11:36 +0000"  >&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=songoko20000&quot; class=&quot;user-hover&quot; rel=&quot;songoko20000&quot;&gt;songoko songowan&lt;/a&gt; no, it just probably wasn&apos;t the correct way of implementing this&lt;/p&gt;</comment>
                    <comment id="19980" author="danielpitts" created="Thu, 11 Apr 2013 18:58:11 +0000"  >&lt;p&gt;I&apos;m curious if any effort is currently being put into this.  I would really love to have this feature available.&lt;/p&gt;</comment>
                    <comment id="19981" author="ocramius" created="Thu, 11 Apr 2013 19:02:30 +0000"  >&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=danielpitts&quot; class=&quot;user-hover&quot; rel=&quot;danielpitts&quot;&gt;Daniel Pitts&lt;/a&gt; this is being developed in &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-2374&quot; title=&quot;[GH-634] [WIP] Value objects&quot;&gt;DDC-2374&lt;/a&gt; ( &lt;a href=&quot;https://github.com/doctrine/doctrine2/pull/634&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/pull/634&lt;/a&gt; )&lt;/p&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10000">
                <name>Duplicate</name>
                                                <inwardlinks description="is duplicated by">
                            <issuelink>
            <issuekey id="11530">DDC-648</issuekey>
        </issuelink>
                    </inwardlinks>
                            </issuelinktype>
                        <issuelinktype id="10001">
                <name>Reference</name>
                                                <inwardlinks description="is referenced by">
                            <issuelink>
            <issuekey id="14731">DDC-2374</issuekey>
        </issuelink>
                    </inwardlinks>
                            </issuelinktype>
                    </issuelinks>
                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1216] A way to mark an entity to always use result cache. Like @UseResultCache class annotation.</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1216</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;So that even associations, find(), findBy() etc will be affected. Very useful for entities that are being used on every request.&lt;/p&gt;

&lt;p&gt;Is that thinkable?&lt;/p&gt;</description>
                <environment></environment>
            <key id="12726">DDC-1216</key>
            <summary>A way to mark an entity to always use result cache. Like @UseResultCache class annotation.</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="hypno">Reio Piller</reporter>
                        <labels>
                    </labels>
                <created>Sun, 19 Jun 2011 12:49:04 +0000</created>
                <updated>Fri, 6 Apr 2012 13:07:25 +0000</updated>
                                    <version>2.x</version>
                                <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="17780" author="holtkamp" created="Fri, 6 Apr 2012 13:07:25 +0000"  >&lt;p&gt;During development, I tried to have the out-of-the-box ORM layer handle as much of the queries as possible, essentially I used the Repository functions a lot: &lt;/p&gt;

&lt;p&gt;For example, having a specific Repository extend the Doctrine EntityRepository and do something like:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt; 
    public function findByName($name)
    {
        $criteria = array(&apos;_name&apos; =&amp;gt; $name);
        return parent::findBy($criteria);
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;Now all functionality is developed, I am optimizing performance and I find myself having to refer my Repository to my DAO layer which uses DQL, so I can enable the DQL Result Cache...&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt; 
    public function findByName($name)
    {
       //Use the DAO so we can enable DQL ResultSet caching
        return $this-&amp;gt;_getDao()-&amp;gt;loadByName($name);
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;


&lt;p&gt;It would be nice to be able to configure &apos;DQL Result Cache = on&apos; on Repository level as well...&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2213] Paginator does not work with composite primary key entity</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2213</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Paginator does not work with composed primary key.&lt;/p&gt;

&lt;p&gt;&quot;Single id is not allowed on composite primary key in entity&quot; exception is thrown here &lt;br/&gt;
&lt;a href=&quot;https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Tools/Pagination/WhereInWalker.php#L90&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Tools/Pagination/WhereInWalker.php#L90&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Only first column values are fetched while retrieving primary keys here&lt;br/&gt;
&lt;a href=&quot;https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Tools/Pagination/Paginator.php#L173&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Tools/Pagination/Paginator.php#L173&lt;/a&gt;&lt;/p&gt;</description>
                <environment>php 5.4</environment>
            <key id="14332">DDC-2213</key>
            <summary>Paginator does not work with composite primary key entity</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="thestanislav">Stanislav Anisimov</reporter>
                        <labels>
                        <label>composed</label>
                        <label>key</label>
                        <label>paginator</label>
                    </labels>
                <created>Tue, 25 Dec 2012 13:24:27 +0000</created>
                <updated>Wed, 23 Jan 2013 21:20:21 +0000</updated>
                                    <version>2.3.1</version>
                                                <component>ORM</component>
                <component>Tools</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>4</watches>
                        <comments>
                    <comment id="19369" author="ocramius" created="Wed, 23 Jan 2013 21:20:21 +0000"  >&lt;p&gt;Limitation was confused by issue reporter and considered bug&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2401] INDEX BY not working on multiple columns</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2401</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;According to the docs on this page: &lt;br/&gt;
&lt;a href=&quot;http://docs.doctrine-project.org/en/latest/reference/dql-doctrine-query-language.html#using-index-by&quot; class=&quot;external-link&quot;&gt;http://docs.doctrine-project.org/en/latest/reference/dql-doctrine-query-language.html#using-index-by&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The following &quot;multi-dimensional index&quot; should be perfectly possible, with a default hydration mode:&lt;br/&gt;
SELECT b as business, p as product FROM Businesses b INDEX BY b.id JOIN Products p WITH b.id = p.businessid INDEX BY p.id&lt;/p&gt;

&lt;p&gt;However, b.id is completely ignored (it is a numeric primary key).&lt;/p&gt;

&lt;p&gt;I tried to go further, giving 2 products a matching barcode and indexing by barcode and then a (unique, numeric) productid. Only the barcode worked as a key and only one of the products with a matching barcode was selected. I used this query to test:&lt;br/&gt;
SELECT p FROM Products p INDEX BY p.barcode JOIN p.businessid b INDEX BY p.id&lt;/p&gt;

&lt;p&gt;I also flagged the docs, because I don&apos;t think a userid should/could be starting from 0.&lt;/p&gt;</description>
                <environment></environment>
            <key id="14784">DDC-2401</key>
            <summary>INDEX BY not working on multiple columns</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="quintenvk">Quintenvk</reporter>
                        <labels>
                    </labels>
                <created>Tue, 16 Apr 2013 15:54:58 +0000</created>
                <updated>Thu, 18 Apr 2013 20:17:31 +0000</updated>
                                    <version>2.3.3</version>
                                                <component>Documentation</component>
                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="20047" author="fabio.bat.silva" created="Thu, 18 Apr 2013 13:41:30 +0000"  >&lt;p&gt;Hi Quintenvk&lt;/p&gt;

&lt;p&gt;Could you please try to write a failing test case ?&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</comment>
                    <comment id="20054" author="quintenvk" created="Thu, 18 Apr 2013 18:40:34 +0000"  >&lt;p&gt;I added a testcase. Please note that the database settings are to be configured in Core/simplys/simplys.php, and that the dump is in dummy.sql.&lt;/p&gt;

&lt;p&gt;Apart from that all should run well immediately.&lt;/p&gt;</comment>
                    <comment id="20055" author="quintenvk" created="Thu, 18 Apr 2013 18:42:02 +0000"  >&lt;p&gt;Fabio,&lt;/p&gt;

&lt;p&gt;Please check the zip I just attached. I hope this helps you in finding the problem.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Quinten&lt;/p&gt;</comment>
                    <comment id="20056" author="fabio.bat.silva" created="Thu, 18 Apr 2013 19:28:37 +0000"  >&lt;p&gt;Thanks Quintenvk,&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;SELECT p.barcode, p.id, p.name FROM \core\Simplys\Entity\Products p INDEX BY p.barcode JOIN p.businessid b INDEX BY p.id&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;In this DQL you are trying to index by scalar values, &lt;br/&gt;
I think we does not support that, and a single dimensional array is the expected result in this case.&lt;/p&gt;

&lt;p&gt;Also the &lt;a href=&quot;http://docs.doctrine-project.org/en/latest/reference/dql-doctrine-query-language.html#using-index-by&quot; class=&quot;external-link&quot;&gt;INDEX BY&lt;/a&gt; documentations seems wrong to me.&lt;/p&gt;


&lt;p&gt;The given DQL : &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; SELECT u.id, u.status, upper(u.name) nameUpper FROM User u INDEX BY u.idJOIN u.phonenumbers p INDEX BY p.phonenumber &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Show the following result :&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;array
  0 =&amp;gt;
    array
      1 =&amp;gt;
        object(stdClass)[299]
          &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &apos;__CLASS__&apos; =&amp;gt; string &apos;Doctrine\Tests\Models\CMS\CmsUser&apos; (length=33)
          &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &apos;id&apos; =&amp;gt; &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; 1
          ..
      &apos;nameUpper&apos; =&amp;gt; string &apos;ROMANB&apos; (length=6)
  1 =&amp;gt;
    array
      2 =&amp;gt;
        object(stdClass)[298]
          &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &apos;__CLASS__&apos; =&amp;gt; string &apos;Doctrine\Tests\Models\CMS\CmsUser&apos; (length=33)
          &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &apos;id&apos; =&amp;gt; &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; 2
          ...
      &apos;nameUpper&apos; =&amp;gt; string &apos;JWAGE&apos; (length=5)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Which IMHO represents another DQL, 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; SELECT u, p , upper(u.name) nameUpper FROM User u INDEX BY u.id JOIN u.phonenumbers p INDEX BY p.phonenumber&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="20057" author="quintenvk" created="Thu, 18 Apr 2013 19:34:33 +0000"  >&lt;p&gt;Thanks for your reply Fabio. &lt;br/&gt;
Do you think there could be alternatives (apart from a foreach-loop) to achieve the expected result?&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Quinten&lt;/p&gt;</comment>
                    <comment id="20058" author="fabio.bat.silva" created="Thu, 18 Apr 2013 19:47:06 +0000"  >&lt;p&gt;Not sure if it&apos;s exactly the result you need but you can try &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;SELECT p, b FROM \core\Simplys\Entity\Products p INDEX BY p.barcode JOIN p.businessid b INDEX BY p.id&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;or 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;SELECT PARTIAL p.{id, barcode, name}, b.{id, attributesYouNeed} FROM \core\Simplys\Entity\Products p INDEX BY p.barcode JOIN p.businessid b INDEX BY p.id&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And than :&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;
$result = $query-&amp;gt;getArrayResult();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="20059" author="quintenvk" created="Thu, 18 Apr 2013 19:58:55 +0000"  >&lt;p&gt;Both produce the same result as the query I had. I think i&apos;ll move on to loops after a bit more research, too bad it can&apos;t be done (at least for now) though... Would&apos;ve been nice.&lt;/p&gt;

&lt;p&gt;Thanks for your help though!&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11524" name="Testcase.zip" size="2020276" author="quintenvk" created="Thu, 18 Apr 2013 18:40:34 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1149] Optimize OneToMany and ManyToMany without join</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1149</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&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; 
/**
 * @Entity
 * @Table(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;users&quot;&lt;/span&gt;)
 */
class User {

    /**
     * @Column
     * @Id
     */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; $user_id;

    /**
     * @Column
     */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; $email;

    /**
     * @OneToMany(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;Language&quot;&lt;/span&gt;, mappedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;user&quot;&lt;/span&gt;,fetch=&lt;span class=&quot;code-quote&quot;&gt;&quot;EAGER&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; $languages;

}

/**
 * @Entity
 * @Table(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;user_languages&quot;&lt;/span&gt;)
 */
class Language {

    /**
     * @Column
     * @Id
     */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; $user_language_id;

    /**
     * @ManyToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;User&quot;&lt;/span&gt;, inversedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;languages&quot;&lt;/span&gt;)
     * @JoinColumn(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;user_id&quot;&lt;/span&gt;, referencedColumnName=&lt;span class=&quot;code-quote&quot;&gt;&quot;user_id&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; $user;

    /**
     * @Column
     */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; $user_id;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&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;$users = $em-&amp;gt;getRepository(&apos;User&apos;)-&amp;gt;findAll();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Result:&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;SELECT t0.user_id AS user_id1, t0.email AS email2 FROM users t0
SELECT t0.user_language_id AS user_language_id1, t0.user_id AS user_id2, t0.user_id AS user_id3 FROM user_languages t0 WHERE t0.user_id = ?
array(1) {
  [0]=&amp;gt;
  string(1) &lt;span class=&quot;code-quote&quot;&gt;&quot;1&quot;&lt;/span&gt;
}
array(1) {
  [0]=&amp;gt;
  NULL
}
SELECT t0.user_language_id AS user_language_id1, t0.user_id AS user_id2, t0.user_id AS user_id3 FROM user_languages t0 WHERE t0.user_id = ?
array(1) {
  [0]=&amp;gt;
  string(1) &lt;span class=&quot;code-quote&quot;&gt;&quot;2&quot;&lt;/span&gt;
}
array(1) {
  [0]=&amp;gt;
  NULL
}
SELECT t0.user_language_id AS user_language_id1, t0.user_id AS user_id2, t0.user_id AS user_id3 FROM user_languages t0 WHERE t0.user_id = ?
array(1) {
  [0]=&amp;gt;
  string(1) &lt;span class=&quot;code-quote&quot;&gt;&quot;3&quot;&lt;/span&gt;
}
array(1) {
  [0]=&amp;gt;
  NULL
}

...
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Need result:&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;SELECT t0.user_id AS user_id1, t0.email AS email2 FROM users t0
SELECT u0_.user_language_id AS user_language_id0, u0_.user_id AS user_id1, u0_.user_id AS user_id2 FROM user_languages u0_ WHERE u0_.user_id IN (1, 2, 3)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="12634">DDC-1149</key>
            <summary>Optimize OneToMany and ManyToMany without join</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="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/inprogress.png">In Progress</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="morfi">Andrey Kolyshkin</reporter>
                        <labels>
                    </labels>
                <created>Thu, 12 May 2011 09:01:18 +0000</created>
                <updated>Sat, 30 Mar 2013 19:18:40 +0000</updated>
                                    <version>Git Master</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>5</votes>
                        <watches>6</watches>
                        <comments>
                    <comment id="15827" author="beberlei" created="Thu, 12 May 2011 09:58:46 +0000"  >&lt;p&gt;Sure you are on git master? this should be optimized already with fetch=EAGER&lt;/p&gt;</comment>
                    <comment id="15828" author="morfi" created="Thu, 12 May 2011 11:15:22 +0000"  >&lt;p&gt;Attach test file&lt;/p&gt;

&lt;p&gt;I run&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;git clone git:&lt;span class=&quot;code-comment&quot;&gt;//github.com/doctrine/doctrine2.git
&lt;/span&gt;git clone git:&lt;span class=&quot;code-comment&quot;&gt;//github.com/doctrine/common.git
&lt;/span&gt;git clone git:&lt;span class=&quot;code-comment&quot;&gt;//github.com/doctrine/dbal.git&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and run testDoctrine.php&lt;/p&gt;

&lt;p&gt;Result&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;
SELECT t0.user_id AS user_id1 FROM users t0

SELECT t0.post_id AS post_id1, t0.user_id AS user_id2 FROM posts t0 WHERE t0.user_id = ?

array(1) {
  [0]=&amp;gt;
  string(1) &lt;span class=&quot;code-quote&quot;&gt;&quot;1&quot;&lt;/span&gt;
}
array(1) {
  [0]=&amp;gt;
  NULL
}
SELECT t0.post_id AS post_id1, t0.user_id AS user_id2 FROM posts t0 WHERE t0.user_id = ?

array(1) {
  [0]=&amp;gt;
  string(1) &lt;span class=&quot;code-quote&quot;&gt;&quot;2&quot;&lt;/span&gt;
}
array(1) {
  [0]=&amp;gt;
  NULL
}
SELECT t0.post_id AS post_id1, t0.user_id AS user_id2 FROM posts t0 WHERE t0.user_id = ?

array(1) {
  [0]=&amp;gt;
  string(1) &lt;span class=&quot;code-quote&quot;&gt;&quot;3&quot;&lt;/span&gt;
}
array(1) {
  [0]=&amp;gt;
  NULL
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="16571" author="guilhermeblanco" created="Mon, 10 Oct 2011 17:44:07 +0000"  >&lt;p&gt;Please instead of using fetch=&quot;EAGER&quot;, please use fetch=&quot;EXTRA_LAZY&quot;. It would fix your issue.&lt;br/&gt;
I have successfully tested this situation in 2.2-DEV and it works like a charm. =)&lt;/p&gt;</comment>
                    <comment id="19895" author="fludimir" created="Mon, 25 Mar 2013 20:39:03 +0000"  >&lt;p&gt;Doctrine ORM 2.3.3  (Symfony2.2) - using LAZY or EXTRA_LAZY fetch mode there are only one query for:&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;$users = $em-&amp;gt;getRepository(&apos;User&apos;)-&amp;gt;findAll();&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;but additional &lt;b&gt;users_count&lt;/b&gt; queries for&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;foreach($users as $user) $user-&amp;gt;languages-&amp;gt;toArray()&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And if use fetch EAGER - for some reason there are &lt;b&gt;2 x users_count&lt;/b&gt; queries , ie each query&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;SELECT t0.post_id AS post_id1, t0.user_id AS user_id2 FROM posts t0 WHERE t0.user_id = ?&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;with unique user_id executed twice&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10991" name="testDoctrine.php" size="1544" author="morfi" created="Thu, 12 May 2011 11:15:22 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2406] Merging of new detached entities with PrePersist lifecycle callback breaks</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2406</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Merging of new detached entities with PrePersist lifecycle callback breaks:&lt;/p&gt;

&lt;p&gt;Code snippet:&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 A
    {
       /**
        *  @ORM\ManyToOne(targetEntity= ...
        *  @ORM\JoinColumn(name=&quot; ...
        */
        &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $b;
        
        &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getB()
        {
            &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;b;
        }
        
        &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setB($b)
        {
            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;b = $b;
        }
        
        /**
         *
         * @ORM\PrePersist
         *
         * @&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; void
         */
        &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function onPrePersist()
        {
           &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;getB() === &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;) {
                &lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; \Exception(&apos;B instance must be defined);
           }
           ....
        }
    }
    
    class B 
    {
    }
    
    $a = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; A();
    $b = $em-&amp;gt;find(&apos;B&apos;, 1);
    $a-&amp;gt;setB($b);
    $em-&amp;gt;persist($a); &lt;span class=&quot;code-comment&quot;&gt;// works fine as B instance is set
&lt;/span&gt;    $em-&amp;gt;detach($a);
    
    $a = $em-&amp;gt;merge($a) &lt;span class=&quot;code-comment&quot;&gt;// breaks in onPrePersist&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The reason it happens is that the merge operation is trying to persist a new entity created by uow::newInstance($class) without populating its properties first:&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;
 &lt;span class=&quot;code-comment&quot;&gt;// If there is no ID, it is actually NEW.
&lt;/span&gt;    ....
    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ( ! $id) {
        $managedCopy = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;newInstance($class);

        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;persistNew($class, $managedCopy);
    } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
	....
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This should happen first for the $managedCopy:&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;
    &lt;span class=&quot;code-comment&quot;&gt;// Merge state of $entity into existing (managed) entity
&lt;/span&gt;    foreach ($class-&amp;gt;reflClass-&amp;gt;getProperties() as $prop) {
        ....
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="14791">DDC-2406</key>
            <summary>Merging of new detached entities with PrePersist lifecycle callback breaks</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="deatheriam">Oleg Namaka</reporter>
                        <labels>
                        <label>merge,</label>
                        <label>prePersist</label>
                    </labels>
                <created>Fri, 19 Apr 2013 17:01:32 +0000</created>
                <updated>Wed, 1 May 2013 12:24:53 +0000</updated>
                                    <version>2.3.2</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="20123" author="fabio.bat.silva" created="Sun, 28 Apr 2013 20:57:08 +0000"  >&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=beberlei&quot; class=&quot;user-hover&quot; rel=&quot;beberlei&quot;&gt;Benjamin Eberlei&lt;/a&gt;, Is this an expected behavior ?&lt;/p&gt;

&lt;p&gt;I mean.. This issue is about dispatch the event before copy the original values into the managed instance. &lt;br/&gt;
But overall, should &lt;b&gt;$em-&amp;gt;detach()&lt;/b&gt; trigger &lt;b&gt;@PrePersist&lt;/b&gt; events ?&lt;/p&gt;</comment>
                    <comment id="20137" author="beberlei" created="Wed, 1 May 2013 08:48:08 +0000"  >&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=fabio.bat.silva&quot; class=&quot;user-hover&quot; rel=&quot;fabio.bat.silva&quot;&gt;Fabio B. Silva&lt;/a&gt; he talks about $em-&amp;gt;merge() on a detached entity calling pre persist. This should only happen on a NEW entity, not on a DETACHED one.&lt;/p&gt;</comment>
                    <comment id="20146" author="deatheriam" created="Wed, 1 May 2013 12:22:24 +0000"  >&lt;p&gt;I tend to disagree with the statement above about pre persist that should not happen on a detached entity being merged back in. If this event handler contains a business logic that this entity needs to be checked against and the detached entity was modified before the merge operation in a way that invalidates it in the prePersist than I will end up with the invalid entity in the identity map. If the merge operation calls persist it must run the prePersist event handler as well for consistency.&lt;/p&gt;

&lt;p&gt;If there is a logic that prevents persisting invalid entities why should it bypassed in the merge operation?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2133] Issue with Query::iterate and query mixed results</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2133</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Consider this code:&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;
$dql = &quot;
    SELECT Page, Product.name
    FROM Dlayer\\Entity\\Page Page
    INNER JOIN Page.Product Product
    &quot;;
$q = ($em-&amp;gt;createQuery($dql));
foreach ($q-&amp;gt;iterate() as $entry) {
  $page = $entry[0][0];
  $name = $entry[0][&apos;name&apos;];
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This results with undefined index: &apos;name&apos; for the second entry.&lt;/p&gt;

&lt;p&gt;First result keys are (notice just one array element with index 0):&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;
0
array(2) {
  [0] =&amp;gt;
  &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;(0)
  [1] =&amp;gt;
  string(4) &lt;span class=&quot;code-quote&quot;&gt;&quot;name&quot;&lt;/span&gt;
} 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;but all others are different (notice two array elements with index 0 and the other one that is incrementing):&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;
the second one:
0
array(1) {
  [0] =&amp;gt;
  &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;(0)
}
1
array(1) {
  [0] =&amp;gt;
  string(4) &lt;span class=&quot;code-quote&quot;&gt;&quot;name&quot;&lt;/span&gt;
} 
the third one:
0
array(1) {
  [0] =&amp;gt;
  &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;(0)
}
2
array(1) {
  [0] =&amp;gt;
  string(4) &lt;span class=&quot;code-quote&quot;&gt;&quot;name&quot;&lt;/span&gt;
} 

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;What&apos;s wrong with this approach? Is it a bug or mixed results should not be used with the iterate method?&lt;/p&gt;</description>
                <environment></environment>
            <key id="14206">DDC-2133</key>
            <summary>Issue with Query::iterate and query mixed results</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="deatheriam">Oleg Namaka</reporter>
                        <labels>
                    </labels>
                <created>Fri, 9 Nov 2012 01:45:16 +0000</created>
                <updated>Wed, 1 May 2013 21:26:21 +0000</updated>
                                    <version>2.2.1</version>
                                <fixVersion>3.0</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="18968" author="beberlei" created="Mon, 12 Nov 2012 14:16:28 +0000"  >&lt;p&gt;This is a known issue that we don&apos;t have found a BC fix for and as I understand &lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=guilhermeblanco&quot; class=&quot;user-hover&quot; rel=&quot;guilhermeblanco&quot;&gt;Guilherme Blanco&lt;/a&gt; requires considerable refactoring. &lt;/p&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10000">
                <name>Duplicate</name>
                                                <inwardlinks description="is duplicated by">
                            <issuelink>
            <issuekey id="12890">DDC-1314</issuekey>
        </issuelink>
                    </inwardlinks>
                            </issuelinktype>
                    </issuelinks>
                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2254] Exporting and restoring a query.</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2254</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;When you have a queryBuilder and you want to break it down using getDQLParts, You can&apos;t restore it by looping over the parts and adding them.&lt;/p&gt;

&lt;p&gt;This is what I am doing:&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;
$parts = $qb-&amp;gt;getDQLParts();

&lt;span class=&quot;code-comment&quot;&gt;// save the parts and use them in a different environment.
&lt;/span&gt;
$newQb = $em-&amp;gt;createQueryBuilder();
foreach ($parts as $name =&amp;gt; $part) {
  $newQb-&amp;gt;add($name, $part);
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>OSX</environment>
            <key id="14406">DDC-2254</key>
            <summary>Exporting and restoring a query.</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="nousefreak">Dries De Peuter</reporter>
                        <labels>
                        <label>dql</label>
                        <label>rebuild</label>
                        <label>restore</label>
                        <label>save</label>
                    </labels>
                <created>Wed, 23 Jan 2013 20:02:34 +0000</created>
                <updated>Sat, 4 May 2013 11:43:53 +0000</updated>
                                    <version>Git Master</version>
                <version>2.3.2</version>
                                                <component>Documentation</component>
                <component>DQL</component>
                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="19363" author="nousefreak" created="Wed, 23 Jan 2013 20:21:11 +0000"  >&lt;p&gt;I wrote a test showing the issue.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/NoUseFreak/doctrine2/commit/8574b79fd3d245532bbe7e310c5cbe083892057a&quot; class=&quot;external-link&quot;&gt;https://github.com/NoUseFreak/doctrine2/commit/8574b79fd3d245532bbe7e310c5cbe083892057a&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="20205" author="beberlei" created="Sat, 4 May 2013 11:43:53 +0000"  >&lt;p&gt;This is not a bug, because restoring queries is not yet a feature of the QueryBuilder. Marking as possible improvement for future.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2147] Custom annotation in MappedSuperclass</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2147</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;When you try use custom annotation in mappedsuperclass like here &lt;a href=&quot;http://pastebin.com/YMxKvcLk&quot; class=&quot;external-link&quot;&gt;http://pastebin.com/YMxKvcLk&lt;/a&gt; and then i try get metadata for class i get this error &lt;br/&gt;
Undefined index: fieldName&lt;br/&gt;
ClassMetadataInfo.php  function addInheritedFieldMapping&lt;br/&gt;
Problem is that custom annotation doesnt have fieldName. &lt;br/&gt;
Quick fix is add condition to test if fieldName isset. &lt;/p&gt;</description>
                <environment>Linux 3.6.6-1.fc17.x86_64</environment>
            <key id="14227">DDC-2147</key>
            <summary>Custom annotation in MappedSuperclass</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="10000" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/needinfo.png">Awaiting Feedback</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="ocramius">Marco Pivetta</assignee>
                                <reporter username="kluk">kluk</reporter>
                        <labels>
                    </labels>
                <created>Thu, 15 Nov 2012 07:46:38 +0000</created>
                <updated>Tue, 7 May 2013 21:24:53 +0000</updated>
                                    <version>2.2.1</version>
                                                <component>Mapping Drivers</component>
                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="18988" author="kluk" created="Thu, 15 Nov 2012 09:24:39 +0000"  >&lt;p&gt;error log from orm:validate-schema&lt;/p&gt;</comment>
                    <comment id="19373" author="ocramius" created="Wed, 23 Jan 2013 21:47:56 +0000"  >&lt;p&gt;Copying from pastebin:&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;
use \Doctrine\ORM\Mapping as ORM;
use \xxx\Doctrine\Annotation\Entity as re;
use \xxx\Doctrine\Annotation\Forms as rf;
use \Doctrine\Common\Collections;
 
/**
 * @ORM\Entity
 */
class EventPicture &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; \Picture
{
 
    /**
     * @ORM\ManyToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;Event&quot;&lt;/span&gt;, inversedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;eventPicture&quot;&lt;/span&gt;)
     * @ORM\JoinColumn(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;FK_Event&quot;&lt;/span&gt;, referencedColumnName=&lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $event;
 
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&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;
use \Doctrine\ORM\Mapping as ORM;
use \xxx\Doctrine\Annotation\Entity as re;
use \xxx\Doctrine\Annotation\Forms as rf;
use \Doctrine\Common\Collections;
 
/** @ORM\MappedSuperclass */
class Picture &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; \xxx\Doctrine\Entity\BaseEntity
{
 
    /**
     * @ORM\Id
     * @ORM\Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;)
     * @ORM\GeneratedValue(strategy=&lt;span class=&quot;code-quote&quot;&gt;&quot;IDENTITY&quot;&lt;/span&gt;)
     * @&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; type
     */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $id;
 
    /**
     * @ORM\Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;string&quot;&lt;/span&gt;,unique=&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;, nullable=&lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;)
     *  @rf\FileUpload(fileSize=&lt;span class=&quot;code-quote&quot;&gt;&quot;php&quot;&lt;/span&gt;,uploadType=&lt;span class=&quot;code-quote&quot;&gt;&quot;local&quot;&lt;/span&gt;,fieldName=&lt;span class=&quot;code-quote&quot;&gt;&quot;link&quot;&lt;/span&gt;,formControl=&lt;span class=&quot;code-quote&quot;&gt;&quot;FileUploadField&quot;&lt;/span&gt;,image=&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;)
     *
     */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $link;
 
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=kluk&quot; class=&quot;user-hover&quot; rel=&quot;kluk&quot;&gt;kluk&lt;/a&gt; does this happen also with any other simple custom annotation? For example following:&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;
/**
 * @Annotation 
 * @Target({&lt;span class=&quot;code-quote&quot;&gt;&quot;PROPERTY&quot;&lt;/span&gt;,&lt;span class=&quot;code-quote&quot;&gt;&quot;ANNOTATION&quot;&lt;/span&gt;})
 */
&lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; class Entity &lt;span class=&quot;code-keyword&quot;&gt;implements&lt;/span&gt; Annotation
{
    /**
     * @&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; string
     */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; $value;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="19438" author="kluk" created="Wed, 30 Jan 2013 08:28:42 +0000"  >&lt;p&gt;the same error when using simple annotation.&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-none&quot;&gt; 
&amp;lt;?php

use \Doctrine\ORM\Mapping as ORM;
use \xxx\Doctrine\Annotation\Entity as re;
use \xxx\Doctrine\Annotation\Forms as rf;
use \Doctrine\Common\Collections;

/** @ORM\MappedSuperclass */
class Picture extends \xxx\Doctrine\Entity\BaseEntity {

    /**
     * @ORM\Id
     * @ORM\Column(type=&quot;integer&quot;)
     * @ORM\GeneratedValue(strategy=&quot;IDENTITY&quot;)
     * @var type
     */
    protected $id;

   
    /**
     * @ORM\Column(type=&quot;integer&quot;)
     * @rf\SetClass({&quot;class&quot;,&quot;hide&quot;})
     */
    public $value;

    /**
     * @ORM\Column(type=&quot;string&quot;,unique=true, nullable=true)
     * @rf\FileUpload(fileSize=&quot;php&quot;,uploadType=&quot;local&quot;,fieldName=&quot;link&quot;,formControl=&quot;FileUploadField&quot;,image=true)
     *
     */
    protected $link;

}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 


&lt;p&gt;When i remove $value , $picture from class everything goes ok.&lt;br/&gt;
Easy fix for me is change ClassMetadataInfo.&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-none&quot;&gt;
    /**
     * INTERNAL:
     * Adds a field mapping without completing/validating it.
     * This is mainly used to add inherited field mappings to derived classes.
     *
     * @param array $fieldMapping
     *
     * @return void
     */
    public function addInheritedFieldMapping(array $fieldMapping)
    {
        if(isset($fieldMapping[&apos;fieldName&apos;])){
        $this-&amp;gt;fieldMappings[$fieldMapping[&apos;fieldName&apos;]] = $fieldMapping;
        $this-&amp;gt;columnNames[$fieldMapping[&apos;fieldName&apos;]] = $fieldMapping[&apos;columnName&apos;];
        $this-&amp;gt;fieldNames[$fieldMapping[&apos;columnName&apos;]] = $fieldMapping[&apos;fieldName&apos;];
        }
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;But i dont know if this fix can break another part of doctrine.&lt;/p&gt;</comment>
                    <comment id="20211" author="beberlei" created="Sat, 4 May 2013 12:31:51 +0000"  >&lt;p&gt;Can you put the code of your annotations online? I can&apos;t seem to understand why this happens.&lt;/p&gt;</comment>
                    <comment id="20226" author="kluk" created="Tue, 7 May 2013 21:24:53 +0000"  >&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unable to find source-code formatter for language: php.&lt;/span&gt; Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml&lt;/div&gt;&lt;pre&gt; 
namespace libs\Doctrine\Annotation\Entity;
use Doctrine\Common\Annotations\Annotation;

/** @Annotation */
class CustomMapping &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Annotation
{
    /**
     *
     * @&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; string
     */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; $className;
    /**
     * 
     * 
     * @&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; IQueryable| string
     */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; $dataSource;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; </comment>
                </comments>
                    <attachments>
                    <attachment id="11349" name="error.log" size="2364" author="kluk" created="Thu, 15 Nov 2012 09:24:39 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2411] Null values get reset when rehydrating an already managed entity</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2411</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Scenario:&lt;/p&gt;

&lt;p&gt;1) You have an entity with a ManyToOne relation (and probably other kinds too, but this is all I have tested) to another entity which is nullable. For example, let&apos;s say you have a Book entity which has an &quot;illustrator&quot; field which refers to a Person entity, representing the person who illustrated the book. If the book is not illustrated then you set the field to null.&lt;/p&gt;

&lt;p&gt;2) You fetch a Book (by ID) which has its illustrator set to a particular Person.&lt;/p&gt;

&lt;p&gt;3) You set that Book&apos;s illustrator to null.&lt;/p&gt;

&lt;p&gt;4) Without flushing, you fetch the Book again, using different criteria: for example, by title. Because entities are Identity Mapped, this will run a query but then locate the same instance in memory, and try to hydrate that instance with the old data it just fetched.&lt;/p&gt;

&lt;p&gt;5) Any fields on the instance that have modified values retain their new values (for example, if we changed the illustrator to a different Person, this would be retained), BUT any fields on the instance which are null get overwritten with the old data (so if we previously set the illustrator to null, without flushing, it would now be reset to the Person value that it had before).&lt;/p&gt;

&lt;p&gt;There seems to be a mistaken assumption here that null values are fields that have not been hydrated, when this is not necessarily the case. Is this the intended behaviour?&lt;/p&gt;

&lt;p&gt;The code that causes this behaviour is here: &lt;a href=&quot;https://github.com/doctrine/doctrine2/blob/e561f47cb2205565eb873f0643637477bfcfc2ff/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php#L471&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/blob/e561f47cb2205565eb873f0643637477bfcfc2ff/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php#L471&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are wondering why anybody would want to fetch the entity again in step 4, my use case for this is the Symfony Validator (but I presume there could be others).&lt;/p&gt;

&lt;p&gt;If there are any unique constraints (Symfony ones, not Doctrine ones) on the entity, e.g. if we had a unique constraint on the Book title field, then when validating the Book the Symfony Validator would check if there are already any Book entities with the same title as the Book we&apos;re validating. It will find the Book that we are working with, and because entities are identity mapped, it will act upon the same instance, and the situation above occurs.&lt;/p&gt;

&lt;p&gt;Code example:&lt;/p&gt;

&lt;p&gt;&amp;lt;?php&lt;/p&gt;

&lt;p&gt;// Create some entities&lt;/p&gt;

&lt;p&gt;$john = new Person();&lt;br/&gt;
$john-&amp;gt;setName(&apos;John Smith&apos;);&lt;/p&gt;

&lt;p&gt;$jane = new Person();&lt;br/&gt;
$jane-&amp;gt;setName(&apos;Jane Jones&apos;);&lt;/p&gt;

&lt;p&gt;$joe = new Person();&lt;br/&gt;
$joe-&amp;gt;setName(&apos;Joe Bloggs&apos;);&lt;/p&gt;

&lt;p&gt;$book = new Book();&lt;br/&gt;
$book-&amp;gt;setId(123);&lt;br/&gt;
$book-&amp;gt;setTitle(&apos;Book Title&apos;);&lt;br/&gt;
$book-&amp;gt;setIllustrator($john);&lt;br/&gt;
$book-&amp;gt;setAuthor($jane);&lt;/p&gt;

&lt;p&gt;$em-&amp;gt;persist($john);&lt;br/&gt;
$em-&amp;gt;persist($jane);&lt;br/&gt;
$em-&amp;gt;persist($joe);&lt;br/&gt;
$em-&amp;gt;persist($book);&lt;br/&gt;
$em-&amp;gt;flush();&lt;/p&gt;

&lt;p&gt;// Now let&apos;s try modifying the book&lt;/p&gt;

&lt;p&gt;$book = $bookRepository-&amp;gt;find(123);&lt;br/&gt;
$book-&amp;gt;getIllustrator(); // returns Person &quot;John Smith&quot;&lt;br/&gt;
$book-&amp;gt;getAuthor(); // returns Person &quot;Jane Jones&quot;&lt;/p&gt;

&lt;p&gt;// make some changes&lt;br/&gt;
$book-&amp;gt;setIllustrator(null); // illustrator is now null&lt;br/&gt;
$book-&amp;gt;setAuthor($joe); // author is now &quot;Joe Bloggs&quot;&lt;/p&gt;

&lt;p&gt;// now validate our changes with Symfony Validator&lt;br/&gt;
// note: the same effect can also be observed with&lt;br/&gt;
//     $test = $bookRepository-&amp;gt;findBy(&apos;title&apos;, &apos;Book Title&apos;);&lt;br/&gt;
$validator-&amp;gt;validate($book);&lt;/p&gt;

&lt;p&gt;// what happened to our book??&lt;br/&gt;
$book-&amp;gt;getIllustrator(); // returns Person &quot;John Smith&quot; &amp;lt;- should be null&lt;br/&gt;
$book-&amp;gt;getAuthor(); // returns Person &quot;Joe Bloggs&quot; &amp;lt;- correctly retains the new value&lt;/p&gt;</description>
                <environment></environment>
            <key id="14801">DDC-2411</key>
            <summary>Null values get reset when rehydrating an already managed entity</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="sgarner">Simon Garner</reporter>
                        <labels>
                        <label>hydration</label>
                    </labels>
                <created>Tue, 23 Apr 2013 12:37:56 +0000</created>
                <updated>Thu, 9 May 2013 10:31:16 +0000</updated>
                                    <version>2.3</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="20100" author="fabio.bat.silva" created="Wed, 24 Apr 2013 18:48:14 +0000"  >&lt;p&gt;Hi Simon,&lt;/p&gt;

&lt;p&gt;Could you please try to write a &lt;a href=&quot;https://github.com/doctrine/doctrine2/blob/master/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1509Test.php&quot; class=&quot;external-link&quot;&gt;failing test case&lt;/a&gt; or paste your entities ?&lt;/p&gt;

&lt;p&gt;Cheers&lt;/p&gt;</comment>
                    <comment id="20235" author="beberlei" created="Thu, 9 May 2013 10:31:16 +0000"  >&lt;p&gt;Verified by code review that this issue exists, but it will be very tricky to fix, because the null check is there for other reasons as well.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2190] findBy() support finding by a single DateTime but not by multiple DateTime</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2190</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;The following code works:&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;$repository-&amp;gt;findBy(array(&apos;date&apos; =&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; \DateTime()))&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;but the following code fails as it does not apply the conversion of the &lt;tt&gt;date&lt;/tt&gt; type for each element:&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;$repository-&amp;gt;findBy(array(&apos;date&apos; =&amp;gt; array(&lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; \DateTime(), &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; \DateTime(&apos;tomorrow&apos;)))&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="14297">DDC-2190</key>
            <summary>findBy() support finding by a single DateTime but not by multiple DateTime</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="stof">Christophe Coevoet</reporter>
                        <labels>
                    </labels>
                <created>Thu, 6 Dec 2012 17:39:00 +0000</created>
                <updated>Thu, 9 May 2013 12:47:37 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="19228" author="beberlei" created="Sun, 6 Jan 2013 09:48:39 +0000"  >&lt;p&gt;This is actually very hard to implement, the problem is that we only have ARRAY constants for PDO::PARAM_INT and PDO::PARAM_STR - all the other types would require special handling.&lt;/p&gt;</comment>
                    <comment id="20241" author="beberlei" created="Thu, 9 May 2013 12:47:37 +0000"  >&lt;p&gt;Attaching failing testcase.&lt;/p&gt;

&lt;p&gt;The idea is to have something like &quot;datetime[]&quot; as type and detect this in the SQLParserUtils of DBAL.&lt;/p&gt;

&lt;p&gt;Another approach would be to convert the values in the ORM already, before passing to the DBAL.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11526" name="DDC2190Test.php" size="569" author="beberlei" created="Thu, 9 May 2013 12:47:37 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1970] DiscriminatorMap recursion when using self-reference</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1970</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I&apos;ve ran into a problem with self-referencing entity. When fetching an entity, recursion occurs, fetching every related entity defined by ManyToOne relation&lt;br/&gt;
(in this example $sponsor), ignoring LAZY or EXTRA_LAZY fetch mode - it executes numerous queries.&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;
/**
 * @ORM\Entity(repositoryClass=&lt;span class=&quot;code-quote&quot;&gt;&quot;Acme\Bundle\UserBundle\Entity\Repository\UserRepository&quot;&lt;/span&gt;)
 * @ORM\Table(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;f_user&quot;&lt;/span&gt;)
 * @ORM\InheritanceType(&lt;span class=&quot;code-quote&quot;&gt;&quot;JOINED&quot;&lt;/span&gt;)
 * @ORM\DiscriminatorColumn(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;type&quot;&lt;/span&gt;, type=&lt;span class=&quot;code-quote&quot;&gt;&quot;string&quot;&lt;/span&gt;)
 * @ORM\DiscriminatorMap({&lt;span class=&quot;code-quote&quot;&gt;&quot;user_person&quot;&lt;/span&gt; = &lt;span class=&quot;code-quote&quot;&gt;&quot;UserPerson&quot;&lt;/span&gt;, &lt;span class=&quot;code-quote&quot;&gt;&quot;user_company&quot;&lt;/span&gt; = &lt;span class=&quot;code-quote&quot;&gt;&quot;UserCompany&quot;&lt;/span&gt;})
 */
&lt;span class=&quot;code-keyword&quot;&gt;abstract&lt;/span&gt; class UserBase &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; FOSUser

/* .... */

    /**
     * @&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; UserBase
     *
     * @ORM\OneToMany(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;UserBase&quot;&lt;/span&gt;, mappedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;sponsor&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $referrals;

    /**
     * @ORM\ManyToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;UserBase&quot;&lt;/span&gt;, inversedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;referrals&quot;&lt;/span&gt;)
     * @ORM\JoinColumn(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;sponsor_id&quot;&lt;/span&gt;, referencedColumnName=&lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $sponsor;

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="13942">DDC-1970</key>
            <summary>DiscriminatorMap recursion when using self-reference</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="kolah">Krzysztof Kolasiak</reporter>
                        <labels>
                    </labels>
                <created>Mon, 6 Aug 2012 18:54:11 +0000</created>
                <updated>Fri, 10 May 2013 15:29:53 +0000</updated>
                                    <version>2.3</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>4</watches>
                        <comments>
                    <comment id="18504" author="asm89" created="Tue, 14 Aug 2012 20:17:31 +0000"  >&lt;p&gt;I have changed this into a feature request because you have hit the limitations of using inheritance and self referencing entities.&lt;/p&gt;

&lt;p&gt;Doctrine2 cannot currently lazy load UserBase#$sponsor because we don&apos;t know which proxy we have to insert. It can either be UserPerson or UserCompany. In order to know this Doctrine2 &lt;em&gt;has&lt;/em&gt; to query the actual object to determine its type. The current strategy is then to load the actual entity because we have all data anyway.&lt;/p&gt;

&lt;p&gt;In order to implement this feature we need to insert a proxy instead of the actual entity. If we do that there should be no recursion happening.&lt;/p&gt;</comment>
                    <comment id="19577" author="ocramius" created="Thu, 21 Feb 2013 09:55:30 +0000"  >&lt;p&gt;Reduced priority&lt;/p&gt;</comment>
                    <comment id="20266" author="notprathap" created="Fri, 10 May 2013 15:29:53 +0000"  >&lt;p&gt;It&apos;d be great if this is a configurable option.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2449] Amazon Redshift Support</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2449</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;It would be nice to get doctrine compatible with Amazon Redshift. It uses a Postgres connector but there are some differences. I&apos;m currently facing an issue with the primary id, in Redshift the generation of an id is different from Postgres and so I&apos;m getting errors associated with generating an id.&lt;/p&gt;

&lt;p&gt;Here are some references that might be useful:&lt;br/&gt;
node-orm faced the same issue and seems like they figured it out: &lt;a href=&quot;https://github.com/dresende/node-orm2/issues/39&quot; class=&quot;external-link&quot;&gt;https://github.com/dresende/node-orm2/issues/39&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Amazon Manual:&lt;br/&gt;
&lt;a href=&quot;http://awsdocs.s3.amazonaws.com/redshift/latest/redshift-dg.pdf&quot; class=&quot;external-link&quot;&gt;http://awsdocs.s3.amazonaws.com/redshift/latest/redshift-dg.pdf&lt;/a&gt;&lt;/p&gt;</description>
                <environment>Amazon Redshift</environment>
            <key id="14955">DDC-2449</key>
            <summary>Amazon Redshift Support</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="10000" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/needinfo.png">Awaiting Feedback</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="kfuchs">Kirill F</reporter>
                        <labels>
                    </labels>
                <created>Wed, 15 May 2013 23:08:21 +0000</created>
                <updated>Wed, 15 May 2013 23:09:12 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1431] Current event system is not flexible enough</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1431</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Hi!&lt;/p&gt;

&lt;p&gt;According to &lt;a href=&quot;http://www.doctrine-project.org/docs/orm/2.1/en/reference/events.html&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/docs/orm/2.1/en/reference/events.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Current event system seem to be not as flexible as it could be.&lt;/p&gt;

&lt;p&gt;1. &lt;b&gt;According Lifecycle Events of the entity (marked with @HasLifecycleCallbacks annotation tag)&lt;/b&gt;:&lt;br/&gt;
It would be useful to have access to Entity Manager inside the callbacks. This could be achieved by passing the entity manager as a parameter to all these callbacks. &lt;/p&gt;

&lt;p&gt;Here is the situation:&lt;br/&gt;
I have an entity for a news item. After somehow modifying this entity and before persisting I want to be able to change the inner association of images linked to this news (for example parsed from news body text). From the OO point of view it&apos;s a task of the News entity itself so this should be done a callback. But since inside callback I do not have access to entity manager (to find existing image entities and only if not found creating a new one) I cannot do this.&lt;br/&gt;
This leads to creating a separate event listener which is split from the news entity (and that is not possible, see 2.).&lt;/p&gt;

&lt;p&gt;Passing entity manager to callbacks may improve it&apos;s usefulness.&lt;/p&gt;

&lt;p&gt;2. &lt;b&gt;Currently there is no events to be called before the changes have been computed. And there is no callback to be called after flush has been finished. (preFlush, postFlush)&lt;/b&gt;&lt;br/&gt;
The problem:&lt;br/&gt;
Assume we have a News entity. I want to modify external system (even not written in PHP) via remote call after any change to news being made. This has to be called AFTER the flush has persisted all the changes. Currently the only place to do this is onFlush (which is called before the persisting is done).&lt;br/&gt;
PostPersist, postRemove, postUpdate cannot be used as it&apos;s called after each one entity is modified and we cannot tell when all entites has been processed.&lt;/p&gt;

&lt;p&gt;Also I faced a problem when implementing the event listener for situation 1. If I register the onFlush listener - the entites changeset is already calculated. If I change something according associations I loose this changes. &lt;br/&gt;
If I call $unitOfWork-&amp;gt;computeChangeSet($classMetadata, $entity) or $unitOfWork-&amp;gt;recomputeSingleEntityChangeSet($classMetadata, $entity); I only get the changes being made after previous changeset calculation loosing the initial changes. I think the preFlush could be a lifesaver for this (to be called before computing the changeset for the first time).&lt;/p&gt;


</description>
                <environment>Doctrine 2.1</environment>
            <key id="13096">DDC-1431</key>
            <summary>Current event system is not flexible enough</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="c0ba">Oleg Stepura</reporter>
                        <labels>
                    </labels>
                <created>Tue, 18 Oct 2011 09:37:45 +0000</created>
                <updated>Tue, 18 Oct 2011 09:40:26 +0000</updated>
                                    <version>2.1</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
            <subtask id="13119">DDC-1449</subtask>
        </subtasks>
        </item>

<item>
            <title>[DDC-1532] PostFlush lifecycle event</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1532</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;In some cases, the database-id of the newly created record is needed in some postproccessing steps, like sending an e-mail containing a link to the just created entity. I&apos;ve recently seen the added support for PostFlush, but this is not a lifecycle event. &lt;/p&gt;

&lt;p&gt;class SomeEntityClass{&lt;/p&gt;

&lt;p&gt;    /** @PostFlush */&lt;br/&gt;
    function sendSomeEmail()&lt;/p&gt;
{
        sendEmail(&apos;
            &apos;Hi, you&apos;re new invoice can be found online: http://www.example.com/invoices/invoice_&apos;.$this-&amp;gt;id
        &apos;;
    }

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;Perhaps it&apos;s even possible to have multiple PostFlush events, that differentiate between the first time a record is created, and when the record is merely updated.&lt;/p&gt;
</description>
                <environment></environment>
            <key id="13257">DDC-1532</key>
            <summary>PostFlush lifecycle event</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="jack@actinum.nl">Jack van Galen</reporter>
                        <labels>
                    </labels>
                <created>Tue, 13 Dec 2011 11:43:26 +0000</created>
                <updated>Wed, 14 Dec 2011 11:13:14 +0000</updated>
                                    <version>Git Master</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="16985" author="jack@actinum.nl" created="Wed, 14 Dec 2011 11:13:14 +0000"  >&lt;p&gt;Okay, please ignore this issue, as I now see that the @PostPersist does exactly what I need. I was thrown by the name, because to me, the order in which stuff happens is persist -&amp;gt; flush. The ID&apos;s are only known after flush, so i&apos;d expected something like postflush to exist. Sorry.&lt;/p&gt;
</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2248] Expire result cache functionality not implemented</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2248</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;According to &lt;a href=&quot;https://doctrine-orm.readthedocs.org/en/latest/reference/dql-doctrine-query-language.html?highlight=expireResultCache&quot; class=&quot;external-link&quot;&gt;documentation&lt;/a&gt; expireResultCache, should force cache to update but it&apos;s not working... Why? Because functionality is not implemented. You can set _expireResultCache variable, but there is no place where this variable is being checked.&lt;/p&gt;</description>
                <environment></environment>
            <key id="14393">DDC-2248</key>
            <summary>Expire result cache functionality not implemented</summary>
                <type id="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/documentation.png">Documentation</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>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="nazin">Piotr Niziniecki</reporter>
                        <labels>
                    </labels>
                <created>Sat, 19 Jan 2013 17:25:33 +0000</created>
                <updated>Sat, 19 Jan 2013 17:40:44 +0000</updated>
                                    <version>2.3</version>
                <version>2.3.1</version>
                <version>2.3.2</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="19336" author="ocramius" created="Sat, 19 Jan 2013 17:40:44 +0000"  >&lt;p&gt;A cache profile can be set and cleaned. I suppose that `expireResultCache` is an old piece of code that survived the refactoring. Should just be removed and documented accordingly&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2452] Additional `WITH` condition in joins between JTI roots cause invalid SQL to be produced</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2452</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Given a simple Joined Table Inheritance like following:&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;
/**
 * @Entity @Table(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;foo&quot;&lt;/span&gt;) @InheritanceType(&lt;span class=&quot;code-quote&quot;&gt;&quot;JOINED&quot;&lt;/span&gt;)
 * @DiscriminatorColumn(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;discr&quot;&lt;/span&gt;, type=&lt;span class=&quot;code-quote&quot;&gt;&quot;string&quot;&lt;/span&gt;)
 * @DiscriminatorMap({&lt;span class=&quot;code-quote&quot;&gt;&quot;foo&quot;&lt;/span&gt; = &lt;span class=&quot;code-quote&quot;&gt;&quot;DDC2452Foo&quot;&lt;/span&gt;, &lt;span class=&quot;code-quote&quot;&gt;&quot;bar&quot;&lt;/span&gt; = &lt;span class=&quot;code-quote&quot;&gt;&quot;DDC2452Bar&quot;&lt;/span&gt;})
 */
class DDC2452Foo
{
    /** @Id @Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;) @GeneratedValue */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; $id;
}

/** @Entity @Table(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;bar&quot;&lt;/span&gt;) */
class DDC2452Bar &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; DDC2452Foo
{
}&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Following DQL&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;SELECT foo1 FROM DDC2452Foo foo1 JOIN DDC2452Foo foo2 WITH 1=1&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Will produce broken SQL:&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;SELECT
    f0_.id AS id0, f0_.discr AS discr1 
FROM 
    foo f0_ 
LEFT JOIN bar b1_ 
    ON f0_.id = b1_.id 
LEFT JOIN foo f2_ 
LEFT JOIN bar b3_ 
    ON f2_.id = b3_.id 
    ON (1 = 1)&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;(please note the duplicate `ON` in the SQL)&lt;/p&gt;

&lt;p&gt;That is caused because of the SQL walker producing the JTI filter with already the `ON` clause in it.&lt;/p&gt;

&lt;p&gt;That happens because the JTI join conditions are added in &lt;a href=&quot;https://github.com/doctrine/doctrine2/blob/2.4.0-BETA2/lib/Doctrine/ORM/Query/SqlWalker.php#L823-L825&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/blob/2.4.0-BETA2/lib/Doctrine/ORM/Query/SqlWalker.php#L823-L825&lt;/a&gt; (`walkRangeVariableDeclaration`), while the additional defined `WITH` conditions are considered in `walkJoinAssociationDeclaration` later on.&lt;/p&gt;

&lt;p&gt;Added a test case and fix at &lt;a href=&quot;https://github.com/doctrine/doctrine2/pull/668&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/pull/668&lt;/a&gt;&lt;/p&gt;</description>
                <environment>irrelevant</environment>
            <key id="14958">DDC-2452</key>
            <summary>Additional `WITH` condition in joins between JTI roots cause invalid SQL to be produced</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</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="ocramius">Marco Pivetta</assignee>
                                <reporter username="ocramius">Marco Pivetta</reporter>
                        <labels>
                        <label>dql</label>
                        <label>sql-walker</label>
                    </labels>
                <created>Thu, 16 May 2013 14:05:48 +0000</created>
                <updated>Thu, 16 May 2013 16:23:40 +0000</updated>
                                    <version>Git Master</version>
                                <fixVersion>2.4</fixVersion>
                                <component>DQL</component>
                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1884] leftJoin via composite key part not hydrated if joining table solely consists of identifiers</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1884</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Suppose I have the following entities:
&lt;br class=&quot;atl-forced-newline&quot; /&gt;&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;/**
 * @ORM\Entity
 * @ORM\Table(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;driver&quot;&lt;/span&gt;)
 */
class Driver
{
    /**
     * @ORM\Id
     * @ORM\Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;)
     * @ORM\GeneratedValue(strategy=&lt;span class=&quot;code-quote&quot;&gt;&quot;AUTO&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $id;
    
    /**
     * @ORM\Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;string&quot;&lt;/span&gt;, length=255);
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $name;
    
    /**
     * @ORM\OneToMany(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;DriverRide&quot;&lt;/span&gt;, mappedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;driver&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $driverRides;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&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;/**
 * @ORM\Entity
 * @ORM\Table(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;driver_ride&quot;&lt;/span&gt;)
 */
class DriverRide
{
    /**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;Driver&quot;&lt;/span&gt;, inversedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;driverRides&quot;&lt;/span&gt;)
     * @ORM\JoinColumn(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;driver_id&quot;&lt;/span&gt;, referencedColumnName=&lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $driver;
    
    /**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;Car&quot;&lt;/span&gt;, inversedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;carRides&quot;&lt;/span&gt;)
     * @ORM\JoinColumn(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;car&quot;&lt;/span&gt;, referencedColumnName=&lt;span class=&quot;code-quote&quot;&gt;&quot;brand&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $car;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&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;/**
 * @ORM\Entity
 * @ORM\Table(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;car&quot;&lt;/span&gt;)
 */
class Car
{
    /**
     * @ORM\Id
     * @ORM\Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;string&quot;&lt;/span&gt;, length=25)
     * @ORM\GeneratedValue(strategy=&lt;span class=&quot;code-quote&quot;&gt;&quot;NONE&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $brand;
    
    /**
     * @ORM\Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;string&quot;&lt;/span&gt;, length=255);
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $model;
    
    /**
     * @ORM\OneToMany(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;DriverRide&quot;&lt;/span&gt;, mappedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;car&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $carRides;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And want to query for Cars that a Driver drove in:
&lt;br class=&quot;atl-forced-newline&quot; /&gt;&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;$qb = $em-&amp;gt;createQueryBuilder();

$qb-&amp;gt;select(&apos;d, dr, c&apos;)
   -&amp;gt;from(&apos;Driver&apos;, &apos;d&apos;)
   -&amp;gt;leftJoin(&apos;d.driverRides&apos;, &apos;dr&apos;)
   -&amp;gt;leftJoin(&apos;dr.car&apos;, &apos;c&apos;)
   -&amp;gt;where(&apos;d.id = ?1&apos;) /* some Driver id */
   -&amp;gt;getQuery()-&amp;gt;getArrayResult();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;b&gt;Expected results:&lt;/b&gt;&lt;br/&gt;
I expect to get an array with an index &apos;driverRides&apos; with an array of Cars (depending on the data of course).&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Actual result:&lt;/b&gt;&lt;br/&gt;
Just an array with Driver data.&lt;/p&gt;

&lt;p&gt;When I started doing some testing I found out I get a different result when I add a third column to the DriverRide table that isn&apos;t part of the composite primary key.&lt;br/&gt;
Now I did get a &apos;driverRides&apos; array, but with just a single row and not three as I expected to get in my case.&lt;/p&gt;

&lt;p&gt;When I removed the composite key and used an auto-generated id-column, everything worked as expected.&lt;/p&gt;

&lt;p&gt;Some test data you might want to use:&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;INSERT INTO `car` (`brand`, `model`) VALUES
(&apos;BMW&apos;, &apos;7 Series&apos;),
(&apos;Crysler&apos;, &apos;300&apos;),
(&apos;Mercedes&apos;, &apos;C-&lt;span class=&quot;code-object&quot;&gt;Class&lt;/span&gt;&apos;),
(&apos;Volvo&apos;, &apos;XC90&apos;);

INSERT INTO `driver` (`id`, `name`) VALUES
(1, &apos;John Doe&apos;),
(2, &apos;Foo Bar&apos;);

INSERT INTO `driver_ride` (`driver_id`, `car`) VALUES
(1, &apos;Crysler&apos;),
(1, &apos;Mercedes&apos;),
(1, &apos;Volvo&apos;),
(2, &apos;BMW&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>MAMP</environment>
            <key id="13791">DDC-1884</key>
            <summary>leftJoin via composite key part not hydrated if joining table solely consists of identifiers</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/inprogress.png">In Progress</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="scoolen">Sander Coolen</reporter>
                        <labels>
                    </labels>
                <created>Wed, 20 Jun 2012 15:06:08 +0000</created>
                <updated>Thu, 9 May 2013 22:14:27 +0000</updated>
                                    <version>2.2.0-RC1</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="18195" author="beberlei" created="Thu, 5 Jul 2012 19:11:27 +0000"  >&lt;p&gt;Can you update to at least 2.2.1 and try again, because this fix here &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-1652&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DDC-1652&lt;/a&gt; look like it could be related to your problem.&lt;/p&gt;</comment>
                    <comment id="18224" author="scoolen" created="Sat, 7 Jul 2012 14:46:47 +0000"  >&lt;p&gt;We&apos;re already using the 2.2.x-dev package. It does look similar to &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-1652&quot; title=&quot;ArrayHydrator with composite primary key&quot;&gt;&lt;del&gt;DDC-1652&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="18241" author="scoolen" created="Sun, 8 Jul 2012 12:34:57 +0000"  >&lt;p&gt;Added testcase on 2.1.x (not the right one unfortunately) branch: &lt;a href=&quot;https://github.com/doctrine/doctrine2/pull/395&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/pull/395&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;BTW I was adding said testcase on master and got an error similar to &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-979&quot; title=&quot;ArrayHydrator::updateResultPointer() must be an array, string given&quot;&gt;&lt;del&gt;DDC-979&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="20261" author="beberlei" created="Thu, 9 May 2013 22:14:27 +0000"  >&lt;p&gt;I upgraded the testcase to master locally, and it seems to fail on Array hydration only now, with a notice:&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;Exception: [PHPUnit_Framework_Error] Argument 1 passed to Doctrine\ORM\Internal\Hydration\ArrayHydrator::updateResultPointer() must be of the type array, string given, called in /home/benny/code/php/workspace/doctrine2/lib/Doctrine/ORM/Internal/Hydration/ArrayHydrator.php on line 196 and defined
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I remember fixing something similar for ObjectHydration (which works for your testcases). Will investigate more when I have time.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2235] Single table inheritance discriminator in WHERE when using arbitrary join syntax</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2235</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;The condition on the discriminator column is placed in the WHERE clause when using arbitrary join syntax, which renders LEFT JOINs useless.&lt;/p&gt;

&lt;p&gt;Given these classes:&lt;br/&gt;
A - no inheritance&lt;br/&gt;
B1 - abstract, root of a hierarchy, discriminator column is named &apos;type&apos;&lt;br/&gt;
I setup a query builder like 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;
$qb-&amp;gt;select(&apos;a.id AS idA, b.id AS idB&apos;)
    -&amp;gt;from(&apos;\Entity\A&apos;, &apos;a&apos;)
    -&amp;gt;leftJoin(&apos;\Entity\B1&apos;, &apos;b&apos;, \Doctrine\ORM\Query\Expr\Join::WITH, &apos;a.something=b.something&apos;);
And the SQL Doctrine generates is something like &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;:
SELECT a.id, b.id FROM a LEFT JOIN b ON (a.something=b.something) WHERE b.type IN (&apos;1&apos;, &apos;2&apos;, &apos;3&apos;)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The problems is that the WHERE condition makes the left join useless.&lt;/p&gt;

&lt;p&gt;The condition on the discriminator column should be placed in the JOIN clause to avoid the problem.&lt;/p&gt;</description>
                <environment></environment>
            <key id="14374">DDC-2235</key>
            <summary>Single table inheritance discriminator in WHERE when using arbitrary join syntax</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/reopened.png">Reopened</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="asm89">Alexander</assignee>
                                <reporter username="jay.eff">Jordi Forns</reporter>
                        <labels>
                    </labels>
                <created>Fri, 11 Jan 2013 12:45:37 +0000</created>
                <updated>Thu, 23 May 2013 16:01:36 +0000</updated>
                                    <version>2.3</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>3</votes>
                        <watches>8</watches>
                        <comments>
                    <comment id="19526" author="aearsis" created="Sun, 10 Feb 2013 21:33:15 +0000"  >&lt;p&gt;Can this be somehow worked around? If not, it is really serious problem... &lt;/p&gt;</comment>
                    <comment id="19560" author="jay.eff" created="Mon, 18 Feb 2013 16:30:42 +0000"  >&lt;p&gt;I couldn&apos;t find any workaround.&lt;br/&gt;
Trying to force the &apos;type&apos; condition in the join clause resulted useless as Doctrine would add the &apos;where&apos; condition regardless.&lt;/p&gt;</comment>
                    <comment id="19883" author="michelsalib" created="Fri, 22 Mar 2013 10:09:18 +0000"  >&lt;p&gt;Easier way to workaround right now, is to declare a OneToMany from class A to class B on a protected field (no need of getter or setter). That way you can do classic join via relationship transversing and then the condition will be placed in the ON part of the query.&lt;/p&gt;</comment>
                    <comment id="19926" author="kmusiclife" created="Mon, 1 Apr 2013 22:40:03 +0000"  >&lt;p&gt;I could access with below codes. You should use RAW SQL it is easy solution I guess. good luck.&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;$qb = $em-&amp;gt;createQueryBuilder();

$qb-&amp;gt;select(&apos;a, b&apos;)
-&amp;gt;from(&apos;YourEntity1&apos;, &apos;a&apos;)
-&amp;gt;leftJoin(&apos;YourEntity2&apos;, &apos;b&apos;, \Doctrine\ORM\Query\Expr\Join::WITH, &apos;a.id = b.relationId&apos;);

$raw_sql = $qb-&amp;gt;where( 
	$qb-&amp;gt;expr()-&amp;gt;in(&apos;a.relationId&apos;, $ids)
)
-&amp;gt;orderBy(&apos;a.updatedAt&apos;, &apos;DESC&apos;)
-&amp;gt;setMaxResults(10)
-&amp;gt;getQuery()-&amp;gt;getSQL();

$conn = $em-&amp;gt;getConnection();
$stmt = $conn-&amp;gt;query($raw_sql);

/* $stmt-&amp;gt;fetchAll(); &lt;span class=&quot;code-comment&quot;&gt;// access as Array */&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="19939" author="beberlei" created="Thu, 4 Apr 2013 18:37:35 +0000"  >&lt;p&gt;Assigned to Alexander&lt;/p&gt;</comment>
                    <comment id="19997" author="beberlei" created="Sun, 14 Apr 2013 09:56:47 +0000"  >&lt;p&gt;Duplicate of &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-1940&quot; title=&quot;Doctrine DQL: erroneous sql generation from dql join with &amp;quot;WITH&amp;quot; or &amp;quot;WHERE&amp;quot; clause&quot;&gt;DDC-1940&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="20087" author="jay.eff" created="Mon, 22 Apr 2013 09:38:15 +0000"  >&lt;p&gt;Benjamin: this bug doesn&apos;t seem to be a dupe of &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-1940&quot; title=&quot;Doctrine DQL: erroneous sql generation from dql join with &amp;quot;WITH&amp;quot; or &amp;quot;WHERE&amp;quot; clause&quot;&gt;DDC-1940&lt;/a&gt;. Actually that issue doesn&apos;t seem to be a bug at all.&lt;/p&gt;

&lt;p&gt;As a reminder, the problem in this issue is that when performing arbitrary left joins on entities that are part of a class hierarchy, the discriminator condition is placed in the where clause instead of the join clause. This means that rows that could not be joined will have null values in the discriminator column and thus will not be returned because of the where condition (which will contain something like &quot; where x.discriminator in (1,2,3) &quot;).&lt;/p&gt;</comment>
                    <comment id="20120" author="tarnfeld" created="Sat, 27 Apr 2013 17:43:18 +0000"  >&lt;p&gt;Has this issue been resolved elsewhere? From reading over &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-1940&quot; title=&quot;Doctrine DQL: erroneous sql generation from dql join with &amp;quot;WITH&amp;quot; or &amp;quot;WHERE&amp;quot; clause&quot;&gt;DDC-1940&lt;/a&gt; it doesn&apos;t seem to be a duplicate at all. I&apos;m experiencing the same problem as Jordi and can&apos;t seem to find a solution. Is there any particular reason the `IN ()` predicate is not a part of the join, but instead placed in the main `WHERE` clause?&lt;/p&gt;</comment>
                    <comment id="20122" author="tarnfeld" created="Sun, 28 Apr 2013 17:13:11 +0000"  >&lt;p&gt;I&apos;ve been looking into the root cause of this bug (or feature..) to try and understand why it&apos;s happening, and after trying various possible fixes (a little hard without full understanding of the Doctrine/Query internals) I&apos;ve ended up with a fix that seems to work well for my use case, at least. I&apos;ve not run any of the unit tests (I plan to, and may adjust my fix based on that) but the top revision is my change... &lt;a href=&quot;https://gist.github.com/tarnfeld/a6bb50ec707c7af1c5dc/revisions&quot; class=&quot;external-link&quot;&gt;https://gist.github.com/tarnfeld/a6bb50ec707c7af1c5dc/revisions&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Would love some feedback.&lt;/p&gt;

&lt;p&gt;Pull request here: &lt;a href=&quot;https://github.com/doctrine/doctrine2/pull/656&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/pull/656&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="20127" author="jay.eff" created="Mon, 29 Apr 2013 14:56:54 +0000"  >&lt;p&gt;Tom&apos;s fix moves the condition of the discriminator column to the LEFT JOIN, which is exactly what was needed.&lt;/p&gt;

&lt;p&gt;Alexander: could you please give it a look?&lt;/p&gt;</comment>
                    <comment id="20429" author="jay.eff" created="Thu, 23 May 2013 16:01:36 +0000"  >&lt;p&gt;Tom&apos;s proposal seems to fix the issue.&lt;/p&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10000">
                <name>Duplicate</name>
                                <outwardlinks description="duplicates">
                            <issuelink>
            <issuekey id="13875">DDC-1940</issuekey>
        </issuelink>
                    </outwardlinks>
                                            </issuelinktype>
                    </issuelinks>
                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-878] Don&apos;t explicitly require object members (fields) to be defined in the entity class</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-878</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Currently, Doctrine REQUIRES that a given entity class have protected or private members explicitly defined in the class (even if meta data mapping is handled elsewhere, such as in YAML). This is less than optimal...for example, many class implementations prefer to store all data in a protected $fields member, as an array, accessing the members with getters and setters.&lt;/p&gt;

&lt;p&gt;Doctrine makes this behavior impossible. An exception is thrown if a field defined in meta data is not an explicit member of the class. Instead, it should &apos;take the meta data&apos;s word for it&apos; that the field exists, and is accessible via getters and setters, without explicitly checking for the member. The meta data is already the authoritative source, I don&apos;t see why the double check should (or needs to) be performed (although I am not familiar with Doctrine internals). Since Doctrine recommends making members private, I have to assume it is already hydrating them with the get/set accessors anyway...so it should just rely on them.&lt;/p&gt;

&lt;p&gt;Quick example use case (notice &apos;name&apos; is not actually a member...it is stored in $fields and assume meta data is defined in a separate yaml file):&lt;/p&gt;

&lt;p&gt;class User &lt;/p&gt;
{
protected $fields = array();

public function getName()
{
return $this-&amp;gt;fields[&apos;name&apos;];
}

public function setName($name)
{
$this-&amp;gt;fields[&apos;name&apos;] = $name;
}

}</description>
                <environment></environment>
            <key id="12104">DDC-878</key>
            <summary>Don&apos;t explicitly require object members (fields) to be defined in the entity class</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="nd987">Nick Daugherty</reporter>
                        <labels>
                    </labels>
                <created>Tue, 16 Nov 2010 01:19:35 +0000</created>
                <updated>Tue, 16 Nov 2010 13:12:24 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="14743" author="beberlei" created="Tue, 16 Nov 2010 03:07:56 +0000"  >&lt;p&gt;This maybe a potential optimization for a very future version. However currently we heavily rely on the Reflection support for properties, which kind of makes a change of this a very complex undertaking.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1103] Addding an event before the load of collections</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1103</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;An event triggered when loading collections would be useful for performances. The use case would be batch querying some stuff instead of doing a query per object of the collection in a postLoad event.&lt;br/&gt;
For instance, the Translatable extension from &lt;a href=&quot;https://github.com/l3pp4rd/DoctrineExtensions&quot; class=&quot;external-link&quot;&gt;https://github.com/l3pp4rd/DoctrineExtensions&lt;/a&gt; loads the translations on postLoad which result in many queries. Being able to load them all in a single query would be useful.&lt;/p&gt;</description>
                <environment></environment>
            <key id="12534">DDC-1103</key>
            <summary>Addding an event before the load of collections</summary>
                <type id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/newfeature.png">New Feature</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="stof">Christophe Coevoet</reporter>
                        <labels>
                    </labels>
                <created>Tue, 5 Apr 2011 02:45:57 +0000</created>
                <updated>Tue, 5 Apr 2011 03:20:22 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="15680" author="gediminasm" created="Tue, 5 Apr 2011 03:20:22 +0000"  >&lt;p&gt;I think custom persisters will solve these issues, lets wait for them, there are already enough events&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1010] Crash when fetching results from qb inside postLoad event</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1010</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I registered an event listener to my entity manager and on a postLoad event, I want to prepare some data in a nice way (fetch translations for my library + store into associative array into entity). Here&apos;s my snippet:&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 TranslationListener &lt;span class=&quot;code-keyword&quot;&gt;implements&lt;/span&gt; EventSubscriber
{
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getSubscribedEvents()
    {
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; array(Events::postLoad);
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function postLoad(LifecycleEventArgs $args)
    {
        $em = $args-&amp;gt;getEntityManager();
        $entity = $args-&amp;gt;getEntity();

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($entity &lt;span class=&quot;code-keyword&quot;&gt;instanceof&lt;/span&gt; Lib) {
            $qb = $em-&amp;gt;createQueryBuilder();
            $qb = $qb-&amp;gt;select(&apos;T&apos;)-&amp;gt;from(&apos;Translate&apos;, &apos;T&apos;)-&amp;gt;join(&apos;T.locale&apos;, &apos;TT&apos;)-&amp;gt;where(&apos;T.lib = ?1&apos;)-&amp;gt;setParameter(1, $entity-&amp;gt;idLib);
            $res = $qb-&amp;gt;getQuery()-&amp;gt;getResult();
            foreach ($res as $tr) {
                $entity-&amp;gt;tr[$tr-&amp;gt;locale-&amp;gt;idLocale] = $tr;
            }
        }
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;When this code is run (eg. getting the Library objects), I got a crash where getResult() is called:&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;
Fatal error: Call to a member function fetch() on a non-object in /home/thepianoguy/testproject/trunk/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php on line 126
Call Stack
#	Time	Memory	Function	Location
1	0.0004	656080	{main}( )	../index.php:0
2	0.1081	18760176	TApplication-&amp;gt;run( )	../index.php:48
3	0.2637	33817288	TApplication-&amp;gt;runService( )	../TApplication.php:382
4	0.2637	33817288	TPageService-&amp;gt;run( )	../TApplication.php:1095
5	0.2698	34788448	TPageService-&amp;gt;runPage( )	../TPageService.php:444
6	0.2715	34986768	TPage-&amp;gt;run( )	../TPageService.php:498
7	0.2716	34989128	TPage-&amp;gt;processNormalRequest( )	../TPage.php:198
8	0.3383	42770128	TControl-&amp;gt;loadRecursive( )	../TPage.php:215
9	0.3383	42770208	ContactUserAddEdit-&amp;gt;onLoad( )	../TControl.php:1286
10	0.3383	42771912	ContactUserAddEdit-&amp;gt;loadData( )	../ContactUserAddEdit.php:56
11	0.3452	43436904	Doctrine\ORM\AbstractQuery-&amp;gt;getResult( )	../ContactUserAddEdit.php:124
12	0.3452	43437296	Doctrine\ORM\AbstractQuery-&amp;gt;execute( )	../AbstractQuery.php:366
13	0.4160	47009328	Doctrine\ORM\Internal\Hydration\AbstractHydrator-&amp;gt;hydrateAll( )	../AbstractQuery.php:537
14	0.4160	47011504	Doctrine\ORM\Internal\Hydration\ObjectHydrator-&amp;gt;_hydrateAll( )	../AbstractHydrator.php:99
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If I comment the line 137 in Doctrine/ORM/Internal/Hydration/AbstractHydrator in _cleanup(), my code works fine:&lt;br/&gt;
//        $this-&amp;gt;_stmt = null;&lt;/p&gt;

&lt;p&gt;I think there is a problem when using alredy used entity manager and query builder inside the postLoad event.&lt;/p&gt;</description>
                <environment>PHP 5.3.3-1ubuntu9.3&lt;br/&gt;
KUbuntu 10.10</environment>
            <key id="12342">DDC-1010</key>
            <summary>Crash when fetching results from qb inside postLoad event</summary>
                <type id="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/documentation.png">Documentation</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="thepianoguy">Matevz Jekovec</reporter>
                        <labels>
                    </labels>
                <created>Tue, 1 Feb 2011 05:16:36 +0000</created>
                <updated>Wed, 23 Jan 2013 22:37:11 +0000</updated>
                                    <version>2.0.1</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="15208" author="beberlei" created="Wed, 2 Feb 2011 13:37:34 +0000"  >&lt;p&gt;The hydrator is reused internally, this is potentially dangerous as I figure from your use-case.&lt;/p&gt;</comment>
                    <comment id="15209" author="beberlei" created="Wed, 2 Feb 2011 13:45:15 +0000"  >&lt;p&gt;A workaround is to re-registr the object hydrator under a new name&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;$configuration-&amp;gt;setHydrationMode(&lt;span class=&quot;code-quote&quot;&gt;&quot;object2&quot;&lt;/span&gt;, &lt;span class=&quot;code-quote&quot;&gt;&quot;Doctrine\ORM\Internal\Hydration\ObjectHydrator&quot;&lt;/span&gt;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and use it in your query.&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;$query-&amp;gt;setHydrationMode(&lt;span class=&quot;code-quote&quot;&gt;&quot;object2&quot;&lt;/span&gt;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="19387" author="ocramius" created="Wed, 23 Jan 2013 22:37:11 +0000"  >&lt;p&gt;Marking as documentation issue, since the user has to be warned that `postLoad` has to use a dedicated hydrator to execute more load operations.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-935] copy function needs implementation</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-935</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;The (deep)copy function of the entity manager is not yet implemented. I assume this is known, but I could not find any open issue on it. This is a pretty powerfull feature once implemented. The function body is completely empty however. Perhaps the tried code could be added so I and others could try and resolve the known issue with this function (recursion limit reached). &lt;/p&gt;</description>
                <environment></environment>
            <key id="12231">DDC-935</key>
            <summary>copy function needs implementation</summary>
                <type id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/task.png">Task</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="jackvangalen">Jack van Galen</reporter>
                        <labels>
                    </labels>
                <created>Wed, 15 Dec 2010 10:29:00 +0000</created>
                <updated>Sun, 2 Jan 2011 03:13:16 +0000</updated>
                                    <version>2.0-RC2</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="14970" author="beberlei" created="Wed, 15 Dec 2010 12:07:26 +0000"  >&lt;p&gt;There was never code written for that function. I don&apos;t think its too problematic that this is missing. You only have to implement __clone (and do so safely as the docs/cookbook describes) and then pass this structure to persist. Optionally making use of cascade persist.&lt;/p&gt;</comment>
                    <comment id="15080" author="mstoehr" created="Sat, 1 Jan 2011 12:34:04 +0000"  >&lt;p&gt;I recently came accross this. Is there any best practice if you have to clone an entity who has several associations? I thought of grabbing them and clone them one by one. Or is there a more convenient way?&lt;/p&gt;</comment>
                    <comment id="15086" author="beberlei" created="Sun, 2 Jan 2011 03:12:50 +0000"  >&lt;p&gt;no, except implementing __clone and doing it there.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1444] Be able to set a value also used in relation</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1444</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I am using a string field for data and for an optional relation too. &lt;br/&gt;
I am not using a ID because the second entity is from a third party application.&lt;/p&gt;

&lt;p&gt;I used two variables in my entity mapping to the same field.&lt;/p&gt;

&lt;p&gt;     /**&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;@var string $an&lt;br/&gt;
     *&lt;/li&gt;
	&lt;li&gt;@ORM\Column(name=&quot;an&quot;, type=&quot;string&quot;, length=20, nullable=false)&lt;br/&gt;
     */&lt;br/&gt;
    private $an;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;    /**    &lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;@ORM\OneToOne(targetEntity=&quot;DataLinked&quot;)&lt;/li&gt;
	&lt;li&gt;@ORM\JoinColumn(name=&quot;an&quot;, referencedColumnName=&quot;part&quot;)&lt;br/&gt;
     */&lt;br/&gt;
    private $linked;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;The getter is working fine.&lt;/p&gt;


&lt;p&gt;The problem occurs when I create a new entity and would like to persist it.&lt;br/&gt;
As the field is used twice, the value of the second variable is erasing the first value.&lt;/p&gt;


&lt;p&gt;At the line 525 of Doctrine\ORM\Persisters\BasicEntityPersister , I added the following test to update a null value only if there is no fieldName existing.&lt;/p&gt;

&lt;p&gt;...&lt;br/&gt;
                foreach ($assoc&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;sourceToTargetKeyColumns&amp;#39;&amp;#93;&lt;/span&gt; as $sourceColumn =&amp;gt; $targetColumn) {&lt;br/&gt;
                    if ($newVal === null) {&lt;br/&gt;
                        if(!isset($this-&amp;gt;_class-&amp;gt;fieldNames&lt;span class=&quot;error&quot;&gt;&amp;#91;$sourceColumn&amp;#93;&lt;/span&gt;) || in_array($sourceColumn, $this-&amp;gt;_class-&amp;gt;identifier)) &lt;/p&gt;
{
                            $result[$owningTable][$sourceColumn] = null;
                        }
&lt;p&gt;                    } else if ($targetClass-&amp;gt;containsForeignIdentifier) {&lt;br/&gt;
...&lt;/p&gt;


&lt;p&gt;(!isset($this-&amp;gt;_class-&amp;gt;fieldNames&lt;span class=&quot;error&quot;&gt;&amp;#91;$sourceColumn&amp;#93;&lt;/span&gt;)   : Test if there is no existing fieldName&lt;br/&gt;
in_array($sourceColumn, $this-&amp;gt;_class-&amp;gt;identifier))    : avoid skipping identifier definition because ID is listed in fieldNames!&lt;/p&gt;

&lt;p&gt;What do you think about that?&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13109">DDC-1444</key>
            <summary>Be able to set a value also used in relation</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="rapotor">Cedric Lahouste</reporter>
                        <labels>
                    </labels>
                <created>Fri, 21 Oct 2011 09:06:06 +0000</created>
                <updated>Fri, 21 Oct 2011 09:06:06 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1413] Automatically create index for discriminator column</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1413</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;It would be nice if the command line orm schema-tool would suggest an index on the discriminator column for single inheritance tables.  Since that column would almost always be in the query, I can&apos;t think of a case when you wouldn&apos;t want it to be in an index&lt;/p&gt;</description>
                <environment></environment>
            <key id="13078">DDC-1413</key>
            <summary>Automatically create index for discriminator column</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="ajbrown">A.J. Brown</reporter>
                        <labels>
                    </labels>
                <created>Tue, 11 Oct 2011 15:57:13 +0000</created>
                <updated>Tue, 11 Oct 2011 15:57:13 +0000</updated>
                                    <version>2.1.2</version>
                                                <component>ORM</component>
                <component>Tools</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1370] preInsert, postInsert, prePersist, postPersist, preUpdate, postUpdate code and documentation of events</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1370</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Currently we have a set of Lifecycle events, but they seem to be misleading both in actual implementation and documentation.&lt;/p&gt;

&lt;p&gt;One good example is prePersist and postPersist, which is only fired when you&apos;re creating new entities. It should be renamed to preInsert and postInsert.&lt;br/&gt;
As of preUpdate and postUpdate, they seem quite valid.&lt;/p&gt;

&lt;p&gt;But if we rename prePersist and postPersist to (pre|post)Insert, we may have a situation where you wanna cover both insert and update.&lt;br/&gt;
For this, (pre|post)Persist should be reinstated, but acting differently from what it does currently.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13007">DDC-1370</key>
            <summary>preInsert, postInsert, prePersist, postPersist, preUpdate, postUpdate code and documentation of events</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="guilhermeblanco">Guilherme Blanco</reporter>
                        <labels>
                    </labels>
                <created>Fri, 9 Sep 2011 20:03:57 +0000</created>
                <updated>Tue, 20 Dec 2011 22:23:54 +0000</updated>
                                                    <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="16459" author="rdohms" created="Fri, 9 Sep 2011 20:07:39 +0000"  >&lt;p&gt;Also, documentation for post* methods is broken at the website:&lt;/p&gt;

&lt;p&gt;&quot;Changes in here are not relevant to the persistence in the database, but you can use this events to&quot; &lt;/p&gt;

&lt;p&gt;It cuts off in mid-sentence.&lt;/p&gt;</comment>
                    <comment id="16954" author="guilhermeblanco" created="Fri, 9 Dec 2011 04:51:27 +0000"  >&lt;p&gt;RDohms, this paragraph was already sorted out.&lt;/p&gt;

&lt;p&gt;The actual ticket is still valid here.&lt;/p&gt;</comment>
                    <comment id="17079" author="guilhermeblanco" created="Tue, 20 Dec 2011 22:23:54 +0000"  >&lt;p&gt;Updating fix version&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1332] Specify Custom ProxyFactory</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1332</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;My tweet:&lt;/p&gt;

&lt;p&gt;&amp;gt; @beberlei Have you heard of overriding the ProxyFactory to allow caching of lazy-loaded entities? Trying to do that now &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;The majority of our data is quite stagnant and so I was shoehorning the capability of the generated proxies to use a custom class.&lt;/p&gt;

&lt;p&gt;My new proxy, in short, will lazy-load the data as normal the first time around, but also stores it in Memcache using an injected adapter.  Upon subsequent lazy-loading, memcache is used rather than a call to the DB.&lt;/p&gt;

&lt;p&gt;I can&apos;t decide if this is better suited for the EntityPersister (which has already been discussed at length), but it seems to fits nicely with a custom proxy.&lt;/p&gt;</description>
                <environment></environment>
            <key id="12921">DDC-1332</key>
            <summary>Specify Custom ProxyFactory</summary>
                <type id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/newfeature.png">New Feature</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="ericclemmons">Eric Clemmons</reporter>
                        <labels>
                    </labels>
                <created>Mon, 15 Aug 2011 03:52:31 +0000</created>
                <updated>Mon, 15 Aug 2011 13:46:22 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="16337" author="beberlei" created="Mon, 15 Aug 2011 09:59:24 +0000"  >&lt;p&gt;This is the wrong extension point to override the proxy factory. It should be in the persisters.&lt;/p&gt;</comment>
                    <comment id="16339" author="ericclemmons" created="Mon, 15 Aug 2011 13:46:22 +0000"  >&lt;p&gt;Ah, so my doubts were well founded.&lt;/p&gt;

&lt;p&gt;The branch allowing custom EntityPersisters has not been merged in yet, has it?  Or, a better question, will it be?  That will dicate if I need to maintain a separate fork for this functionality or find other means to handle this.&lt;/p&gt;

&lt;p&gt;I know how hesitant we were for adding any extension point, because then we feel we have to support it, which makes me wonder if &quot;LifeCycleCallback::preFetch&quot; or similar is a potential alternative.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1329] Documentation for @JoinColumn may be incorrect</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1329</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;The Documentation for @JoinColumn annotation states:&lt;br/&gt;
&quot;This annotation is not required. If its not specified the attributes name and referencedColumnName are inferred from the table and primary key names.&quot;&lt;/p&gt;

&lt;p&gt;However, this seems not to be correct. If you have non-standard name for the @Id columns for a @OneToMany/@ManyToMany the name and referencedColumnName are not correctly inferred.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://gist.github.com/e61bf8f4462870ffd4f3&quot; class=&quot;external-link&quot;&gt;https://gist.github.com/e61bf8f4462870ffd4f3&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
            <key id="12918">DDC-1329</key>
            <summary>Documentation for @JoinColumn may be incorrect</summary>
                <type id="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/documentation.png">Documentation</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="djones">Damon Jones</reporter>
                        <labels>
                    </labels>
                <created>Sat, 13 Aug 2011 18:35:50 +0000</created>
                <updated>Sat, 13 Aug 2011 18:35:50 +0000</updated>
                                                                    <component>Documentation</component>
                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2134] Add referential integrity check for MySQL to console commands</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2134</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Today I spent some time solving a PHP &apos;White Screen of Death&apos;. I traced it back to a Entity of which the proxy&apos;s __load() function was invoked because af a EXTRA_LAZY association. Due to incorrect database contents (the entry ID was changed due to an update: referential integrity broke), the __load() query resulted in no results. The EntityNotFoundException did for some reason not show up in our logs, probably because the lazy load was triggered by a magic __toString() function.&lt;/p&gt;

&lt;p&gt;The cause is because of the way we populate or tables with domain data: &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;
SET FOREIGN_KEY_CHECKS = 0;
#IMPORT STUFF from CSV
SET FOREIGN_KEY_CHECKS = 1;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;MySQL does not trigger any errors when the foreign key checks are turned back on, leaving the table in an inconsistent state. &lt;/p&gt;

&lt;p&gt;To prevent this, I found some information in this post: &lt;a href=&quot;http://www.mysqlperformanceblog.com/2011/11/18/eventual-consistency-in-mysql/&quot; class=&quot;external-link&quot;&gt;http://www.mysqlperformanceblog.com/2011/11/18/eventual-consistency-in-mysql/&lt;/a&gt;, which I used to come with the following queries&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;
#Check the constraints of a specific database
SELECT *
	FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE 
		WHERE TABLE_SCHEMA = &apos;databaseName&apos;
		AND REFERENCED_TABLE_NAME IS NOT NULL

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&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;
#Generate table specific queries to find orphaned entries
SELECT CONCAT(
	 &apos;SELECT &apos;, GROUP_CONCAT(DISTINCT CONCAT(K.CONSTRAINT_NAME, &apos;.&apos;, P.COLUMN_NAME,
	  &apos; AS `&apos;, P.TABLE_SCHEMA, &apos;.&apos;, P.TABLE_NAME, &apos;.&apos;, P.COLUMN_NAME, &apos;`&apos;) ORDER BY P.ORDINAL_POSITION), &apos; &apos;,
	 	&apos;FROM &apos;, K.TABLE_SCHEMA, &apos;.&apos;, K.TABLE_NAME, &apos; AS &apos;, K.CONSTRAINT_NAME, &apos; &apos;,
	 		&apos;LEFT OUTER JOIN &apos;, K.REFERENCED_TABLE_SCHEMA, &apos;.&apos;, K.REFERENCED_TABLE_NAME, &apos; AS &apos;, K.REFERENCED_TABLE_NAME, &apos; &apos;,
	 		&apos; ON (&apos;, GROUP_CONCAT(CONCAT(K.CONSTRAINT_NAME, &apos;.&apos;, K.COLUMN_NAME) ORDER BY K.ORDINAL_POSITION),
	 		&apos;) = (&apos;, GROUP_CONCAT(CONCAT(K.REFERENCED_TABLE_NAME, &apos;.&apos;, K.REFERENCED_COLUMN_NAME) ORDER BY K.ORDINAL_POSITION), &apos;) &apos;,
	 		&apos;WHERE &apos;, K.REFERENCED_TABLE_NAME, &apos;.&apos;, K.REFERENCED_COLUMN_NAME, &apos; IS NULL;&apos;
	  )
    INTO OUTFILE &apos;/tmp/verifyDatabaseTableIntegrity.sql&apos;
    FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE K
      INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE P
        ON (K.TABLE_SCHEMA, K.TABLE_NAME) = (P.TABLE_SCHEMA, P.TABLE_NAME)
        AND P.CONSTRAINT_NAME = &apos;PRIMARY&apos;
    WHERE K.TABLE_SCHEMA = &apos;databaseName&apos;
      AND K.REFERENCED_TABLE_NAME IS NOT NULL
      GROUP BY K.CONSTRAINT_NAME;
	
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;By running the generated queries, we can now easily find the records that break referential integrity. &lt;/p&gt;

&lt;p&gt;It might be an idea of adding this functionality to the orm:validate-schema, or a new orm:validate-database-integrity?&lt;/p&gt;</description>
                <environment>MySQL</environment>
            <key id="14208">DDC-2134</key>
            <summary>Add referential integrity check for MySQL to console commands</summary>
                <type id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/newfeature.png">New Feature</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="holtkamp">Menno Holtkamp</reporter>
                        <labels>
                    </labels>
                <created>Fri, 9 Nov 2012 13:08:10 +0000</created>
                <updated>Fri, 9 Nov 2012 17:17:04 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1993] New method required: ClassMetadataInfo::isAssociationNullable()</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1993</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;I&apos;m working with Symfony 2.1, and I need to know if an association is nullable for a given entity (to know if a form field should be marked as &apos;required&apos;). So I&apos;d like to have a &lt;tt&gt;isAssociationNullable()&lt;/tt&gt; method in the &lt;tt&gt;ClassMetadataInfo&lt;/tt&gt; class, that should do the same thing that the &lt;tt&gt;isNullable()&lt;/tt&gt; method does for fields.&lt;/p&gt;

&lt;p&gt;You can see more information about the problem on the &lt;a href=&quot;https://github.com/symfony/symfony/issues/5315&quot; class=&quot;external-link&quot;&gt;Symfony issue&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13980">DDC-1993</key>
            <summary>New method required: ClassMetadataInfo::isAssociationNullable()</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="gregoire_m">gregoire_m</reporter>
                        <labels>
                    </labels>
                <created>Wed, 22 Aug 2012 08:24:33 +0000</created>
                <updated>Wed, 22 Aug 2012 08:24:33 +0000</updated>
                                    <version>2.2</version>
                                                <component>Mapping Drivers</component>
                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1988] Add Any and ManyToAny annotations</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1988</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;It would be really nice to have @Any and @ManyToAny relations/annotations implemented like on Hibernate.&lt;br/&gt;
&lt;a href=&quot;http://docs.jboss.org/hibernate/orm/4.1/javadocs/org/hibernate/annotations/ManyToAny.html&quot; class=&quot;external-link&quot;&gt;http://docs.jboss.org/hibernate/orm/4.1/javadocs/org/hibernate/annotations/ManyToAny.html&lt;/a&gt;&lt;br/&gt;
Right now I&apos;ve implemented these in a Symfony2 bundle (that I&apos;d be happy to share once it&apos;s ready and a bit documented), using listeners on postLoad, preFlush and prePersist&lt;br/&gt;
However I think this is a very common use case that anyone will encounter at least once/twice in every middle/big-sized project, and for this reason I think this should be implemented as a core feature.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13973">DDC-1988</key>
            <summary>Add Any and ManyToAny annotations</summary>
                <type id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/newfeature.png">New Feature</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="sroddy">Stefano Rodriguez</reporter>
                        <labels>
                    </labels>
                <created>Sat, 18 Aug 2012 08:50:21 +0000</created>
                <updated>Sat, 18 Aug 2012 09:05:49 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1950] Useful exception when combining Column with ManyToOne</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1950</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;When applying both @Column and @ManyToOne annotations to a field, it blows up with crazy internal errors. It would be great if this case &amp;#8211; and similar cases &amp;#8211; could throw a nice exception which tells the user what he did wrong.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13886">DDC-1950</key>
            <summary>Useful exception when combining Column with ManyToOne</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="igorw">Igor Wiedler</reporter>
                        <labels>
                    </labels>
                <created>Thu, 26 Jul 2012 20:10:42 +0000</created>
                <updated>Thu, 26 Jul 2012 20:10:42 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1630] Get PersistentCollection::getDeleteDiff is empty when collection changes from 1 item to zero items</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1630</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description></description>
                <environment>Symfony2</environment>
            <key id="13405">DDC-1630</key>
            <summary>Get PersistentCollection::getDeleteDiff is empty when collection changes from 1 item to zero items</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="10000" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/needinfo.png">Awaiting Feedback</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="lmcd">Lee</reporter>
                        <labels>
                    </labels>
                <created>Tue, 31 Jan 2012 18:38:16 +0000</created>
                <updated>Sat, 9 Feb 2013 21:52:48 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="17380" author="deeky666" created="Thu, 9 Feb 2012 00:23:50 +0000"  >&lt;p&gt;Same problem here. I wanted to write some unit tests, checking the entity relations and ran into exactly the same problem. Maybe my code can provide some more information (Group entity is the owning side, role entity is the inverse side):&lt;/p&gt;

&lt;p&gt;WHAT DOES NOT WORK:&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;        /**
         * Test ArrayCollection
         */
        $group = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Group(&apos;Group Test&apos;);
        $em-&amp;gt;persist($group);
        $em-&amp;gt;flush();

        $groups = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; ArrayCollection();
        $groups-&amp;gt;add($group);

        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;role-&amp;gt;setGroups($groups);

        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;assertEquals($groups, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;role-&amp;gt;getGroups());

        /**
         * Test PersistentCollection
         */
        $em-&amp;gt;persist($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;role);
        $em-&amp;gt;flush();

        $groups = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;role-&amp;gt;getGroups();
        $groups-&amp;gt;removeElement($group); &lt;span class=&quot;code-comment&quot;&gt;// first remove element before adding a &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; one
&lt;/span&gt;
        $group = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Group(&apos;Group Test 2&apos;);
        $em-&amp;gt;persist($group);
        $em-&amp;gt;flush();
        $groups-&amp;gt;add($group);        

        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;role-&amp;gt;setGroups($groups);

        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;assertEquals($groups, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;role-&amp;gt;getGroups());
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;


&lt;p&gt;WHAT WORKS:&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;        /**
         * Test ArrayCollection
         */
        $group = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Group(&apos;Group Test&apos;);
        $em-&amp;gt;persist($group);
        $em-&amp;gt;flush();

        $groups = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; ArrayCollection();
        $groups-&amp;gt;add($group);

        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;role-&amp;gt;setGroups($groups);

        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;assertEquals($groups, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;role-&amp;gt;getGroups());

        /**
         * Test PersistentCollection
         */
        $em-&amp;gt;persist($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;role);
        $em-&amp;gt;flush();

        $groups = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;role-&amp;gt;getGroups();

        $group2 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Group(&apos;Group Test 2&apos;);
        $em-&amp;gt;persist($group2);
        $em-&amp;gt;flush();
        $groups-&amp;gt;add($group2);  &lt;span class=&quot;code-comment&quot;&gt;// first adding a &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; element before removing one
&lt;/span&gt;
        $groups-&amp;gt;removeElement($group);

        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;role-&amp;gt;setGroups($groups);

        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;assertEquals($groups, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;role-&amp;gt;getGroups());
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Hope this helps in any way... I tried figuring it out on my own but I am too drunk right now xD&lt;/p&gt;</comment>
                    <comment id="17404" author="beberlei" created="Fri, 10 Feb 2012 20:41:45 +0000"  >&lt;p&gt;Thanks for the report, formatted it&lt;/p&gt;</comment>
                    <comment id="17405" author="beberlei" created="Fri, 10 Feb 2012 20:42:00 +0000"  >&lt;p&gt;Which version is that btw?&lt;/p&gt;</comment>
                    <comment id="17429" author="deeky666" created="Thu, 16 Feb 2012 21:52:05 +0000"  >&lt;p&gt;Occurs in version 2.1.6&lt;/p&gt;</comment>
                    <comment id="17452" author="beberlei" created="Mon, 20 Feb 2012 10:00:07 +0000"  >&lt;p&gt;If group is the owning side, why do you only set Role::$groups? This has to be the other way around or not?&lt;/p&gt;</comment>
                    <comment id="17453" author="beberlei" created="Mon, 20 Feb 2012 10:33:24 +0000"  >&lt;p&gt;@Steve&lt;/p&gt;

&lt;p&gt;I cannot reproduce your issue.&lt;/p&gt;

&lt;p&gt;Attached is a test script.&lt;/p&gt;

&lt;p&gt;Your code is very weird btw, why are you getting and setting groups collection? It is passed by reference so you can just have something like $role-&amp;gt;addGroup() and $role-&amp;gt;removeGroup() and encapsulate the logic?&lt;/p&gt;

&lt;p&gt;Also your tests are pretty useless, you check if two variables which are the same reference to the same collection are the same. Which should always be true.&lt;/p&gt;

&lt;p&gt;@Lee&lt;/p&gt;

&lt;p&gt;Can you provide more details? I cant verify this without more details.&lt;/p&gt;</comment>
                    <comment id="19505" author="asm89" created="Sat, 9 Feb 2013 21:52:48 +0000"  >&lt;p&gt;Can anyone provide us with more feedback?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11164" name="DDC1630Test.php" size="1446" author="beberlei" created="Mon, 20 Feb 2012 10:33:39 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1494] Query results are overwritten by previous query.</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1494</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I am running a query that JOINs three tables, with a simple WHERE:&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;$q = $em-&amp;gt;createQuery(&quot;

SELECT cat, n, c
FROM Project_Model_NoticeCategory cat
JOIN cat.notices n
JOIN n.chapters c
WHERE
c.id = :chapter_id

&quot;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;When I do 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;  $q-&amp;gt;setParameter(&apos;chapter_id&apos;, 1);
  $a = $q-&amp;gt;getResult();

  $q-&amp;gt;setParameter(&apos;chapter_id&apos;, 2);
  $b = $q-&amp;gt;getResult();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;$b always has the wrong results. Running the following code:&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;  $q-&amp;gt;setParameter(&apos;chapter_id&apos;, 1);
  $a = $q-&amp;gt;getResult();

  $q-&amp;gt;setParameter(&apos;chapter_id&apos;, 2);
  $b = $q-&amp;gt;getResult();
  $z = $q-&amp;gt;getArrayResult();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;BUG Results: $b != $z (getArrayResult IS CORRECT, it refreshes the results) Note: $a==$b (which is wrong)&lt;/p&gt;

&lt;p&gt;Explanation:&lt;/p&gt;

&lt;p&gt;There is a chapter table, this has a many-to-many join to notices (these are meta info&lt;br/&gt;
about the chapter &amp;#8211; a little like tagging a blog post) the notices are grouped into&lt;br/&gt;
categories.&lt;/p&gt;

&lt;p&gt;Data model:&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;/**
 * @Entity
 * @Table(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;chapter&quot;&lt;/span&gt;)
 */
class Project_Model_Chapter
{
    /**
     * @Id @Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;)
     * @GeneratedValue(strategy=&lt;span class=&quot;code-quote&quot;&gt;&quot;AUTO&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $id;
 
    /** @Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;string&quot;&lt;/span&gt;) */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $title;

	/**
	 * @ManyToMany(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;Project_Model_Notice&quot;&lt;/span&gt;, mappedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;chapters&quot;&lt;/span&gt;)
	 */
	&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $notices;
	
	.... /lots of code snipped/ ....
	
}


/**
 * @Entity
 * @Table(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;notice&quot;&lt;/span&gt;)
 */
class Project_Model_Notice
{
	/**
     * @Id @Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;)
     * @GeneratedValue(strategy=&lt;span class=&quot;code-quote&quot;&gt;&quot;AUTO&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $id;
 
    /** @Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;string&quot;&lt;/span&gt;) */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $title;
	
	/**
	 * @ManyToMany(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;Project_Model_Chapter&quot;&lt;/span&gt;, inversedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;notices&quot;&lt;/span&gt;)
	 * @JoinTable(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;chapter_notice&quot;&lt;/span&gt;)
	 */
	&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $chapters;
	
	/**
	 * @ManyToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;Project_Model_NoticeCategory&quot;&lt;/span&gt;, inversedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;notices&quot;&lt;/span&gt;)
	 */
	&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $notice_category;
	
	.... /lots of code snipped/ ....
	
}

/**
 * @Entity
 * @Table(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;notice_category&quot;&lt;/span&gt;)
 */
class Project_Model_NoticeCategory
{
    /**
     * @Id @Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;)
     * @GeneratedValue(strategy=&lt;span class=&quot;code-quote&quot;&gt;&quot;AUTO&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $id;
	/** @Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;string&quot;&lt;/span&gt;) */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $title;
	
	/**
	 * Bidirectional - One-To-Many (INVERSE SIDE)
	 *
	 * @OneToMany(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;Project_Model_Notice&quot;&lt;/span&gt;, mappedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;notice_category&quot;&lt;/span&gt;, cascade={&lt;span class=&quot;code-quote&quot;&gt;&quot;persist&quot;&lt;/span&gt;, &lt;span class=&quot;code-quote&quot;&gt;&quot;remove&quot;&lt;/span&gt;})
	 */
	&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $notices;

	.... /lots of code snipped/ ....
	
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Data fixtures:&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;$tools = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; \Project_Model_NoticeCategory;
$tools-&amp;gt;setTitle(&apos;Tools&apos;);
		
$spanner = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; \Project_Model_Notice;
$spanner-&amp;gt;setTitle(&apos;spanner&apos;);
$tools-&amp;gt;addNotice($spanner);
		
$drill = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; \Project_Model_Notice;
$drill-&amp;gt;setTitle(&apos;power drill&apos;);
$tools-&amp;gt;addNotice($drill);
		
$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;em-&amp;gt;persist($tools);
$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;em-&amp;gt;flush();

$tools = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; \Project_Model_NoticeCategory;
$tools-&amp;gt;setTitle(&apos;Safety&apos;);
		
$gloves = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; \Project_Model_Notice;
$gloves-&amp;gt;setTitle(&apos;gloves&apos;);
$tools-&amp;gt;addNotice($gloves);
		
$goggles = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; \Project_Model_Notice;
$goggles-&amp;gt;setTitle(&apos;goggles&apos;);
$tools-&amp;gt;addNotice($goggles);
		
$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;em-&amp;gt;persist($tools);
$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;em-&amp;gt;flush();

$chapter1 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; \Project_Model_Chapter;
$chapter1-&amp;gt;setTitle(&apos;Chapter 1&apos;);
$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;em-&amp;gt;persist($chapter1);

$chapter2 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; \Project_Model_Chapter;
$chapter2-&amp;gt;setTitle(&apos;Chapter 2&apos;);
$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;em-&amp;gt;persist($chapter2);

$chapter1-&amp;gt;addNotice($spanner);
$chapter1-&amp;gt;addNotice($gloves);

$chapter2-&amp;gt;addNotice($spanner);
$chapter2-&amp;gt;addNotice($gloves);
$chapter2-&amp;gt;addNotice($drill);
$chapter2-&amp;gt;addNotice($goggles);

&lt;span class=&quot;code-comment&quot;&gt;// now persist and flush everything&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Initial investigation:&lt;/p&gt;

&lt;p&gt;I think it has something to do with HINT_REFRESH ? Stepping through:&lt;/p&gt;

&lt;p&gt;ObjectHydrator-&amp;gt;_hydrateRow&lt;br/&gt;
ObjectHydrator-&amp;gt;_getEntity&lt;/p&gt;

&lt;p&gt;when it requests the Project_Model_Category from the unit of work, it&lt;br/&gt;
seems that the second query is simply grabbing the cached results from&lt;br/&gt;
the first results. This MUST be wrong as the second query uses a&lt;br/&gt;
different query (the ID changes) and all the results are wrong.&lt;/p&gt;
</description>
                <environment>PHP 5.3 + MySQL 5.5</environment>
            <key id="13188">DDC-1494</key>
            <summary>Query results are overwritten by previous query.</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="10000" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/needinfo.png">Awaiting Feedback</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="monk.e.boy">J</reporter>
                        <labels>
                    </labels>
                <created>Tue, 15 Nov 2011 09:56:12 +0000</created>
                <updated>Sat, 9 Feb 2013 20:26:53 +0000</updated>
                                    <version>2.1.2</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="16834" author="beberlei" created="Tue, 15 Nov 2011 10:19:13 +0000"  >&lt;p&gt;Fixed formatting&lt;/p&gt;</comment>
                    <comment id="16870" author="beberlei" created="Fri, 18 Nov 2011 17:43:12 +0000"  >&lt;p&gt;are you using result caching?&lt;/p&gt;</comment>
                    <comment id="16898" author="monk.e.boy" created="Mon, 21 Nov 2011 14:45:09 +0000"  >&lt;p&gt;This is part of my bootstrap&lt;br/&gt;
,&lt;br/&gt;
,&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;		
$config = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; \Doctrine\ORM\Configuration();
		
$cache = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; \Doctrine\Common\Cache\ArrayCache;
$config-&amp;gt;setMetadataCacheImpl($cache);
$config-&amp;gt;setQueryCacheImpl($cache);
		
&lt;span class=&quot;code-comment&quot;&gt;// driver: schema
&lt;/span&gt;$driver = $config-&amp;gt;newDefaultAnnotationDriver(
	APPLICATION_PATH . &apos;/models&apos;
);
$config-&amp;gt;setMetadataDriverImpl($driver);

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="16998" author="beberlei" created="Thu, 15 Dec 2011 20:49:29 +0000"  >&lt;p&gt;Cannot reproduce it with the script attached. Can you try to modify this to fail or write your own testcase?&lt;/p&gt;</comment>
                    <comment id="16999" author="beberlei" created="Thu, 15 Dec 2011 20:49:47 +0000"  >&lt;p&gt;Downgraded&lt;/p&gt;</comment>
                    <comment id="19499" author="asm89" created="Sat, 9 Feb 2013 20:26:43 +0000"  >&lt;p&gt;Please provide extra feedback.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11131" name="DDC1494Test.php" size="1591" author="beberlei" created="Thu, 15 Dec 2011 20:49:29 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1493] Improving in() from ExpressionBuilder</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1493</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Instead of this piece of code:&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;$literal = $expr-&amp;gt;literal($v);
$expr-&amp;gt;andX(
  $expr-&amp;gt;eq(&apos;at.key&apos;, $expr-&amp;gt;literal($k)),
  $expr-&amp;gt;orX(
    $expr-&amp;gt;eq(&apos;a.valueInt&apos;, $literal),
    $expr-&amp;gt;eq(&apos;a.valueText&apos;, $literal),
    $expr-&amp;gt;eq(&apos;a.valueDate&apos;, $literal)
  )
);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I would like to simplify my query by using this syntax:&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;$expr-&amp;gt;andX(
  $expr-&amp;gt;eq(&apos;at.key&apos;, $expr-&amp;gt;literal($k)),
  $expr-&amp;gt;in($expr-&amp;gt;literal($v), array(&apos;a.valueInt&apos;, &apos;a.valueText&apos;, &apos;a.valueDate&apos;))
);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="13187">DDC-1493</key>
            <summary>Improving in() from ExpressionBuilder</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="h-andreas">Andreas H&#246;rnicke</reporter>
                        <labels>
                    </labels>
                <created>Tue, 15 Nov 2011 08:06:02 +0000</created>
                <updated>Tue, 15 Nov 2011 08:06:02 +0000</updated>
                                    <version>2.1.2</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1916] Centralize the Cache mechanism simplifying the query creation</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1916</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Hi all,&lt;/p&gt;

&lt;p&gt;in a big project if you have queries spread out in different&lt;br/&gt;
repositories,&lt;br/&gt;
when you have to modify a cache lifetime, you have to search the query and&lt;br/&gt;
modify the code, than test it.&lt;br/&gt;
Is not so easy also to answer to  &apos;how much is the cache for the query XYZ?&apos; &lt;/p&gt;

&lt;p&gt;the idea:&lt;br/&gt;
Each group of repository (bundle) should have in a single point maybe into its config file a place where you could set the lifetime of the various queries. &lt;/p&gt;

&lt;p&gt;see the code for a better explanation&lt;br/&gt;
&lt;a href=&quot;https://gist.github.com/3075742&quot; class=&quot;external-link&quot;&gt;https://gist.github.com/3075742&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;the pro: a better handling of the cache mechanism&lt;br/&gt;
cons: ?&lt;/p&gt;

&lt;p&gt;Do you think is a good approach?&lt;br/&gt;
Have you ever had a similar problem?&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

&lt;p&gt;liuggio&lt;/p&gt;</description>
                <environment></environment>
            <key id="13834">DDC-1916</key>
            <summary>Centralize the Cache mechanism simplifying the query creation</summary>
                <type id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/newfeature.png">New Feature</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="liuggio">liuggio</reporter>
                        <labels>
                    </labels>
                <created>Mon, 9 Jul 2012 13:02:07 +0000</created>
                <updated>Mon, 9 Jul 2012 13:15:49 +0000</updated>
                                                                    <component>DQL</component>
                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1847] Do not check for type equality in scalars when computing changeset?</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1847</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Decimal type in mysql converts as a string in php. This is great as Decimal has a much higher precision than a float or double and that precision would be lost if converted to a float in PHP. Fine! But when doing calculations (as my numbers do not require an enormous precision gmp_ functions are not necessary) php converts these strings into floats. Then, when computing the changeset, as the value is compared with === is marked as a change even though there is none (&quot;5.00&quot; string vs 5.00 float) and an UPDATE for that row is made. Would it be possible to check only for simple equality &quot;==&quot; instead of type equality &quot;===&quot; when dealing with scalar types?&lt;/p&gt;

&lt;p&gt;Another example of this would be the boolean type, that it is stored as an integer 1 in mysql but converted to a boolean true in php. If during the execution of my code that boolean gets converted to an integer 1, that will trigger an UPDATE also because 1 !== true.&lt;/p&gt;

&lt;p&gt;Should this be my responsability or doctrine should be a little more flexible regarding comparisons? Thanks!!&lt;/p&gt;</description>
                <environment></environment>
            <key id="13743">DDC-1847</key>
            <summary>Do not check for type equality in scalars when computing changeset?</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="acasademont">Albert Casademont</reporter>
                        <labels>
                    </labels>
                <created>Wed, 30 May 2012 15:28:40 +0000</created>
                <updated>Fri, 8 Jun 2012 13:08:49 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="18057" author="ocramius" created="Fri, 8 Jun 2012 07:14:37 +0000"  >&lt;p&gt;Hi there!&lt;br/&gt;
Actually, doctrine orm converts floats from DB string to double at &lt;a href=&quot;https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Types/FloatType.php#L52&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Types/FloatType.php#L52&lt;/a&gt; . Keeping the correct type in for your fields is up to you, so be sure to cast in every setter &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                    <comment id="18061" author="acasademont" created="Fri, 8 Jun 2012 08:22:23 +0000"  >&lt;p&gt;Hi marco!&lt;/p&gt;

&lt;p&gt;Actually i am using DECIMAL (or NUMERIC), not FLOAT, That type is not casted as it would lose precision. Therefore, my problem is when working with DECIMAL (Which is, btw, the type that mysql recommends for storing money values)&lt;br/&gt;
thet&lt;br/&gt;
&lt;a href=&quot;https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Types/DecimalType.php&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Types/DecimalType.php&lt;/a&gt;&lt;/p&gt;

</comment>
                    <comment id="18062" author="ocramius" created="Fri, 8 Jun 2012 10:56:21 +0000"  >&lt;p&gt;Unsure if the cast should happen in the type (just ignorant about the implication in precision), but I&apos;ll suggest it then.&lt;/p&gt;</comment>
                    <comment id="18064" author="acasademont" created="Fri, 8 Jun 2012 11:03:55 +0000"  >&lt;p&gt;It should not happen as the DECIMAL type in MySQL has much more precision than a double or float in PHP. It was previously cast but there was an issue regarding this cast and the cast was deleted&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DBAL-121&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DBAL-121&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that, in another issue a user points out the same problem i am facing, that i have to cast back to string if i do not want doctrine to issue an UPDATE command for values that have not changed&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DBAL-180&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DBAL-180&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As i said, my only point is that maybe, when computing the changeset, the comparison for scalar types should be more relaxed with a == instead of a ===&lt;/p&gt;
</comment>
                    <comment id="18066" author="ocramius" created="Fri, 8 Jun 2012 13:08:49 +0000"  >&lt;p&gt;Don&apos;t think this can be done, as you don&apos;t really know what types (and so also the conversion rules) the user applies to his own model. I wouldn&apos;t do that, leaving the implementor of the entities to have strict checks on types during operations in setters...&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1825] generate entities with traits</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1825</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;When a trait with included setters and getters is used and generate entities is called, doctrine add another set of getters and setters to the &quot;main&quot; entity where the trait is used.&lt;/p&gt;</description>
                <environment>php 5.4.3, symfony2.1-dev</environment>
            <key id="13708">DDC-1825</key>
            <summary>generate entities with traits</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="lunetics">Matthias Breddin</reporter>
                        <labels>
                    </labels>
                <created>Fri, 18 May 2012 11:31:24 +0000</created>
                <updated>Sat, 9 Feb 2013 23:06:18 +0000</updated>
                                    <version>2.2.2</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1819] Allow ResultSetMapping to be used for objects that are not entities</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1819</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Currently &lt;tt&gt;Doctrine\ORM\Query\ResultSetMapping&lt;/tt&gt; can only be used to query the database for entities using the &lt;tt&gt;EntityManager::createNativeQuery&lt;/tt&gt; method. It would be great if we could use this as well for objects that are not entities. That way we can create simple DTO&apos;s and map them to a query using the &lt;tt&gt;ResultSetMapping&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;I&apos;ll open a PR If there are no objections.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13694">DDC-1819</key>
            <summary>Allow ResultSetMapping to be used for objects that are not entities</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="marijn">Marijn Huizendveld</reporter>
                        <labels>
                    </labels>
                <created>Fri, 11 May 2012 15:13:43 +0000</created>
                <updated>Mon, 14 May 2012 10:26:50 +0000</updated>
                                    <version>2.3</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="17941" author="beberlei" created="Fri, 11 May 2012 19:20:38 +0000"  >&lt;p&gt;Good idea. You could make this happen by adding a ArbitraryObjectHydrator that does not use the ClassMetadata but creates ReflectionProperty instances during the hydration.&lt;/p&gt;

&lt;p&gt;Api would then be:&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;$rsm = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; ResultSetMapping();
....

$query = $em-&amp;gt;createNativeQuery($sql, $rsm);
$objects = $query-&amp;gt;getResult(Query::HYDRATOR_ARBITRARY_OBJECTS);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="17944" author="marijn" created="Sun, 13 May 2012 23:24:53 +0000"  >&lt;p&gt;Thanks for your input. I&apos;ll try to work on some tests this week. &lt;/p&gt;</comment>
                    <comment id="17945" author="marijn" created="Mon, 14 May 2012 10:26:50 +0000"  >&lt;p&gt;I&apos;ve &lt;a href=&quot;https://github.com/doctrine/doctrine2/pull/348&quot; class=&quot;external-link&quot;&gt;started working on the test suite in this PR&lt;/a&gt;.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2301] Support inheritance in ResultSetMappingBuilder</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2301</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;ResultSetMappingBuilder does not support inherited fields. For example, calling &lt;tt&gt;ResultSetMappingBuilder::addRootEntityFromClassMetadata($class, $alias)&lt;/tt&gt; throws an exception to say this.&lt;/p&gt;

&lt;p&gt;I was wondering if there were any reasons as to why this would be difficult to implement? I haven&apos;t had an extensive look at Doctrine&apos;s source but it feels like this has been not implemented on purpose.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</description>
                <environment></environment>
            <key id="14488">DDC-2301</key>
            <summary>Support inheritance in ResultSetMappingBuilder</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="rmasters">Ross Masters</reporter>
                        <labels>
                        <label>nativesql</label>
                        <label>resultsetmapping</label>
                    </labels>
                <created>Sat, 16 Feb 2013 22:34:48 +0000</created>
                <updated>Sat, 16 Feb 2013 22:34:48 +0000</updated>
                                    <version>Git Master</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2227] Add details about developer being responsible of inverse side of an association</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2227</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;As far as I know, docs don&apos;t explain that it is up to the developer to keep the object graph consistent instead of relying on Doctrine ORM for everything.&lt;/p&gt;

&lt;p&gt;For example, for many to many, examples like following may be used:&lt;br/&gt;
&lt;a href=&quot;https://gist.github.com/3121916&quot; class=&quot;external-link&quot;&gt;https://gist.github.com/3121916&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
            <key id="14364">DDC-2227</key>
            <summary>Add details about developer being responsible of inverse side of an association</summary>
                <type id="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/documentation.png">Documentation</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="ocramius">Marco Pivetta</assignee>
                                <reporter username="ocramius">Marco Pivetta</reporter>
                        <labels>
                    </labels>
                <created>Wed, 9 Jan 2013 09:44:22 +0000</created>
                <updated>Wed, 9 Jan 2013 09:44:22 +0000</updated>
                                                                    <component>Documentation</component>
                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2200] Duplicates returned while accessing associations from @PostPersist callback</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2200</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;When creating a new Post and adding it to a collection in an &lt;b&gt;existing&lt;/b&gt; Thread (i.e. loaded from the database), referencing Thread&apos;s posts collection in Post&apos;s @PostPersist callback returns the Post twice. To clarify, this only happens when Thread was previously persisted. If I&apos;m creating a new Thread object the code works as expected. I&apos;ve included some sample code to better illustrate my issue.&lt;/p&gt;

&lt;p&gt;I don&apos;t know if this is a bug, or if I&apos;m doing something that I shouldn&apos;t be, but I couldn&apos;t find this limitation mentioned in the documentation, and this seems to go against the expected behavior.&lt;/p&gt;

&lt;p&gt;Here are my sample entities:&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;

/**
 * @Entity
 * @Table(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;thread&quot;&lt;/span&gt;)
 */
class &lt;span class=&quot;code-object&quot;&gt;Thread&lt;/span&gt;
{
    /** 
     * @Id
     * @GeneratedValue
     * @Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $id;

    /** 
     * @OneToMany(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;Post&quot;&lt;/span&gt;, mappedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;thread&quot;&lt;/span&gt;, cascade={&lt;span class=&quot;code-quote&quot;&gt;&quot;persist&quot;&lt;/span&gt;, &lt;span class=&quot;code-quote&quot;&gt;&quot;remove&quot;&lt;/span&gt;})
     */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $posts;

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function __construct() {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;posts = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; ArrayCollection();
    }   

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getPosts() {
        &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;posts-&amp;gt;toArray();
    }   

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function addPost(Post $post) {
        $post-&amp;gt;setThread($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;);
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;posts-&amp;gt;add($post);
    }   
}

/**
 * @Entity
 * @Table(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;post&quot;&lt;/span&gt;)
 * @HasLifecycleCallbacks
 */
class Post
{
    /** 
     * @Id
     * @GeneratedValue
     * @Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $id;

    /** 
     * @ManyToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-object&quot;&gt;Thread&lt;/span&gt;&quot;&lt;/span&gt;, inversedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;posts&quot;&lt;/span&gt;)
     * @JoinColumn(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;thread_id&quot;&lt;/span&gt;, referencedColumnName=&lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $thread;

    &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;
    }   

    /** 
     * @PostPersist
     */
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function onPostPersist() {
        $posts = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;thread-&amp;gt;getPosts();
        foreach ($posts as $post) {
            echo &apos;id: &apos; . $post-&amp;gt;getId() . &apos; type: &apos; . get_class($alert) . &apos;&amp;lt;br /&amp;gt;&apos;;
        }   
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setThread(&lt;span class=&quot;code-object&quot;&gt;Thread&lt;/span&gt; $thread) {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;thread = $thread;
    }   
}

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And the calling code:&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;

&lt;span class=&quot;code-comment&quot;&gt;// Grab an existing thread.
&lt;/span&gt;$thread = $em-&amp;gt;getReference(&apos;&lt;span class=&quot;code-object&quot;&gt;Thread&lt;/span&gt;&apos;, 1); 
$thread-&amp;gt;addPost(&lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Post());
$em-&amp;gt;flush();

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This outputs:&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: 1 type: Post
id: 1 type: Post

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Alternatively:&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;

&lt;span class=&quot;code-comment&quot;&gt;// Create a &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; thread.
&lt;/span&gt;$thread = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;Thread&lt;/span&gt;()
$thread-&amp;gt;addPost(&lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Post());
$em-&amp;gt;persist($thread);
$em-&amp;gt;flush();

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This outputs:&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: 1 type: Post

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="14313">DDC-2200</key>
            <summary>Duplicates returned while accessing associations from @PostPersist callback</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="breathe">Brent</reporter>
                        <labels>
                    </labels>
                <created>Sat, 15 Dec 2012 02:06:07 +0000</created>
                <updated>Sat, 15 Dec 2012 02:06:07 +0000</updated>
                                    <version>2.3.1</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2164] Extend the cache support to eAccelerator</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2164</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;It would be nice if the Doctrine caching drivers would support the eAccelerator library.&lt;/p&gt;</description>
                <environment></environment>
            <key id="14262">DDC-2164</key>
            <summary>Extend the cache support to eAccelerator</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="noise085">Enea Bette</reporter>
                        <labels>
                        <label>cache</label>
                        <label>drivers</label>
                    </labels>
                <created>Fri, 23 Nov 2012 08:29:26 +0000</created>
                <updated>Mon, 26 Nov 2012 08:54:28 +0000</updated>
                                    <version>2.4</version>
                <version>3.0</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="19037" author="ocramius" created="Fri, 23 Nov 2012 08:38:55 +0000"  >&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=noise085&quot; class=&quot;user-hover&quot; rel=&quot;noise085&quot;&gt;Enea Bette&lt;/a&gt; eAccelerator is known for being stripping comments from cached source (making it impossible to use annotations)... Do you happen to know if this is fixed? Supporting it as cache driver is fine btw, I just wonder how many users will start thinking of using eAccelerator and then will be facing this huge limitation.&lt;/p&gt;</comment>
                    <comment id="19063" author="noise085" created="Mon, 26 Nov 2012 08:52:19 +0000"  >&lt;p&gt;I know that eAccelerator has this issue. It would be nice if we could utilize it with XML, YML and PHP based mapping though.&lt;br/&gt;
Do you know if the same problem would appear with these kinds of mapping strategies?&lt;/p&gt;

&lt;p&gt;To give response to your question (eAccelerator and annotations incompatibility), there is a pull request on github, &lt;a href=&quot;https://github.com/eaccelerator/eaccelerator/issues/19&quot; class=&quot;external-link&quot;&gt;https://github.com/eaccelerator/eaccelerator/issues/19&lt;/a&gt; . &lt;/p&gt;

&lt;p&gt;It seems that in the future these could be resolved, and at that time it would be very nice to have that supported with doctrine (symfony2 already has support for this library).&lt;/p&gt;

&lt;p&gt;&quot;I just wonder how many users will start thinking of using eAccelerator and then will be facing this huge limitation&quot;. Sometimes users just does not have a choice. Imagine the case when you have a hosted site that requires caching functionalities and the only available cache library is eAccelerator (as just in my case). You would be fried as a chicken hehe &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2140] [GH-512] Added addParameters() to Query and QueryBuilder</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2140</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;This issue is created automatically through a Github pull request on behalf of jappie:&lt;/p&gt;

&lt;p&gt;  Url: &lt;a href=&quot;https://github.com/doctrine/doctrine2/pull/512&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/pull/512&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Message:&lt;/p&gt;

&lt;p&gt;This method behaves like &lt;tt&gt;setParameters()&lt;/tt&gt; before version 2.3:&lt;br/&gt;
It will add new parameters to the collection, and override any existing positions/names.&lt;/p&gt;

&lt;p&gt;It can take a &lt;tt&gt;Doctrine\Common\Collections\ArrayCollection&lt;/tt&gt; with &lt;tt&gt;Doctrine\ORM\Query\Parameter&lt;/tt&gt; objects, as well as a plain &lt;tt&gt;array&lt;/tt&gt; with key/value pairs, as argument.&lt;/p&gt;

&lt;p&gt;This will greatly ease the upgrade to Doctrine 2.3, because you only need to perform a project-wide replace of &lt;tt&gt;setParameters&lt;/tt&gt; with &lt;tt&gt;addParameters&lt;/tt&gt;, in stead of going into your code and determine if calls to &lt;tt&gt;setParameters&lt;/tt&gt; are ok or need refactoring.&lt;/p&gt;

&lt;p&gt;I&apos;ve also added unit-tests to maintain integrity.&lt;/p&gt;</description>
                <environment>OS X 10.8.2, PHP 5.3.18, Nginx 1.2.4 (php through FPM)</environment>
            <key id="14218">DDC-2140</key>
            <summary>[GH-512] Added addParameters() to Query and QueryBuilder</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="beberlei">Benjamin Eberlei</reporter>
                        <labels>
                        <label>Query,</label>
                        <label>QueryBuilder</label>
                    </labels>
                <created>Tue, 13 Nov 2012 08:51:04 +0000</created>
                <updated>Tue, 20 Nov 2012 08:06:05 +0000</updated>
                                    <version>2.3</version>
                <version>Git Master</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="19008" author="beberlei" created="Tue, 20 Nov 2012 02:50:39 +0000"  >&lt;p&gt;A related Github Pull-Request &lt;span class=&quot;error&quot;&gt;&amp;#91;GH-512&amp;#93;&lt;/span&gt; was closed&lt;br/&gt;
&lt;a href=&quot;https://github.com/doctrine/doctrine2/pull/512&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/pull/512&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="19011" author="jasper@nerdsweide.nl" created="Tue, 20 Nov 2012 08:06:05 +0000"  >&lt;blockquote&gt;
&lt;p&gt;I don&apos;t feel strong need to have such an API.&lt;br/&gt;
If you want to keep track and merge collection of parameters, all you have to do is create an array (or an ArrayCollection), manipulate the instance and then setParameters at the end.&lt;br/&gt;
Unless you give me a stronger argument, this code won&apos;t be in. Closing for now.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Hi Guilherme,&lt;/p&gt;

&lt;p&gt;I agree that such a method makes less sense in &lt;tt&gt;Query&lt;/tt&gt;, because when you write a DQL string all parameters are known at once. But when using the &lt;tt&gt;QueryBuilder&lt;/tt&gt; you might need different parameters in different cases, so &lt;tt&gt;addParameters()&lt;/tt&gt; becomes useful there.&lt;/p&gt;

&lt;p&gt;I guess it&apos;s just a convenience method, like IMHO &lt;tt&gt;setParameter()&lt;/tt&gt; is. (You could just do &lt;tt&gt;$qb-&amp;gt;getParameters()-&amp;gt;add()&lt;/tt&gt;)&lt;/p&gt;

&lt;p&gt;The main reason for adding the method was, like I said, upgrading to Doctrine 2.3. I&apos;ve already upgraded all my projects to Doctrine 2.3, so the method is less useful for me now. But it took me a full day to refactor my repositories, because there is no safe way to automate the process. A simple search-and-replace &lt;tt&gt;setParameters()&lt;/tt&gt; to &lt;tt&gt;addParameters()&lt;/tt&gt; would have taken me 5 minutes &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/wink.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;I&apos;m content with your decision.&lt;br/&gt;
If others find &lt;tt&gt;addParameters()&lt;/tt&gt; useful, I hope they let us know.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1081] Unnecessary JOIN when selecting ManyToMany/Join Table by ID.</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1081</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;With the schema:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt; 
Image
    @Id
    $id

Tag
    @Id
    $Id

Tag_Image
    @Id
    @OneToOne(targetEntity=&quot;Tag&quot;)
    @JoinColumn(name=&quot;tag&quot;)
    $tag

    @Id
    @OneToOne(targetEntity=&quot;Image&quot;)
    @JoinColumn(name=&quot;image&quot;)
    $image
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;Given the following DQL, &lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;    SELECT img
    FROM Image 
    LEFT JOIN img.tags tag
    WHERE tag.id=:tag
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;Doctrine Generates this SQL&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt; 
    SELECT i0_.id AS id1 
    FROM Image i0_ 
    LEFT JOIN Tag_Image t2_ 
        ON i0_.id = t2_.image 
    LEFT JOIN Tag t1_ 
        ON t1_.id = t2_.tag 
    WHERE t1_.id = 37
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 
&lt;p&gt;Which unncessarily joins against Tag, given that the foreign key Tag.id is also found in Tag_Image.tag.&lt;/p&gt;

</description>
                <environment></environment>
            <key id="12503">DDC-1081</key>
            <summary>Unnecessary JOIN when selecting ManyToMany/Join Table by ID.</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/reopened.png">Reopened</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="putgeminmouth">David Reisch</reporter>
                        <labels>
                    </labels>
                <created>Sun, 27 Mar 2011 12:21:20 +0000</created>
                <updated>Mon, 28 Mar 2011 10:03:44 +0000</updated>
                                    <version>2.0</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="15596" author="beberlei" created="Sun, 27 Mar 2011 14:40:41 +0000"  >&lt;p&gt;This is not a bug, but expected behavior.&lt;/p&gt;

&lt;p&gt;You can select against the alias if its on the owning side of the association:&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;SELECT img
FROM Image img 
WHERE img.tag=:tag
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In this case it is not a left join though, if you want a left join you HAVE to join.&lt;/p&gt;</comment>
                    <comment id="15598" author="putgeminmouth" created="Sun, 27 Mar 2011 20:36:44 +0000"  >&lt;p&gt;There is no owning isde of the association, you can clearly see there is an association table/entity.&lt;/p&gt;

&lt;p&gt;I can&apos;t understand how this behavior is expected. If no properties of Tag are selected for, there is no need to join against Tag since the id is already available via the association table.&lt;/p&gt;</comment>
                    <comment id="15599" author="beberlei" created="Mon, 28 Mar 2011 03:36:34 +0000"  >&lt;p&gt;I misread the mappings, sorry, i though its a @OneToOne but its actually an assocition entity with @OneToOnes.&lt;/p&gt;

&lt;p&gt;Can you show me the Image::$tags mapping also?&lt;/p&gt;</comment>
                    <comment id="15606" author="putgeminmouth" created="Mon, 28 Mar 2011 08:27:57 +0000"  >&lt;p&gt;That is correct, thanks for taking another look at this.&lt;br/&gt;
Sorry I had forgotten to include that information.&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;Image
    /**
        @Id
    */
    $id

    /**
        @ManyToMany(targetEntity=&quot;Tag&quot;)
        @JoinTable(name=&quot;Tag_Image&quot;, 
                            joinColumns={@JoinColumn(name=&quot;image&quot;)},
                            inverseJoinColumns={@JoinColumn(name=&quot;tag&quot;)})
    */
    $tags
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="15607" author="beberlei" created="Mon, 28 Mar 2011 08:56:44 +0000"  >&lt;p&gt;The targetEntity is wrong. I suppose it should be Image_Tag or not? If it should be Tag, then you don&apos;t need that Image_Tag entity at all.&lt;/p&gt;

&lt;p&gt;In that case i have to check if you can use the shortcut notation, however it will again not work with the left join - only inner. This is an assumption the ORM makes and there is not yet code included for the optimization. This is not a bug, but an improvement ticket. The functionality works.&lt;/p&gt;</comment>
                    <comment id="15608" author="putgeminmouth" created="Mon, 28 Mar 2011 09:12:26 +0000"  >&lt;p&gt;No argument on the ticket type...&lt;/p&gt;

&lt;p&gt;Ahh, I store some metadata in Tag_Image, which is why I manage it explicitly.&lt;/p&gt;

&lt;p&gt;In any case thanks for looking at this.&lt;/p&gt;</comment>
                    <comment id="15609" author="beberlei" created="Mon, 28 Mar 2011 09:43:12 +0000"  >&lt;p&gt;If you change the targetEntity to Tag_Image then it might already be enough to get this working without another join.&lt;/p&gt;</comment>
                    <comment id="15610" author="putgeminmouth" created="Mon, 28 Mar 2011 10:03:44 +0000"  >&lt;p&gt;With this change, the original query is invalid:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;    LEFT JOIN i.tags t
    WHERE t.id=:tag
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Because i.tags of type Tag_Image has no field id&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;Semantical Error&amp;#93;&lt;/span&gt; line 0, col 138 near &apos;id=:tag &apos;: Error: Class domain\Tag_Image has no field or association named id&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I attempt the logical modification:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;    LEFT JOIN i.tags t
    WHERE t.tag=:tag
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and get&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;SELECT i0_.id AS id0
FROM Image i0_ 
LEFT JOIN Tag_Image t1_ ON i0_.id = t1_.image 
LEFT JOIN Tag_Image t1_ ON t1_.id = t1_.tag 
WHERE t1_.tag = 37
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;42000&amp;#93;&lt;/span&gt;: Syntax error or access violation: 1066 Not unique table/alias: &apos;t1_&lt;/p&gt;&lt;/blockquote&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1716] Better unique constraints handling or even updateIfExists/findOneOrCreate</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1716</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;It is too hard handle rows duplication now. As adviced here &lt;a href=&quot;http://stackoverflow.com/questions/3967226/checking-for-duplicate-keys-with-doctrine-2&quot; class=&quot;external-link&quot;&gt;http://stackoverflow.com/questions/3967226/checking-for-duplicate-keys-with-doctrine-2&lt;/a&gt; we should catch \PDOException with code 23000. This is bad behavior.&lt;/p&gt;

&lt;p&gt;So I propose:&lt;br/&gt;
a. Add DuplicateRowException wich will throwed by flush method (maybe wrapped PDOException) with method &quot;getDuplicatedProperties&quot; (based on sql error description parsing + mapping)&lt;br/&gt;
b. Add method findOneOrCreate (hello, Propel!) or updateIfExists to ObjectInterface, EntityManager&lt;br/&gt;
c. Combine a, b&lt;/p&gt;</description>
                <environment></environment>
            <key id="13542">DDC-1716</key>
            <summary>Better unique constraints handling or even updateIfExists/findOneOrCreate</summary>
                <type id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/newfeature.png">New Feature</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="koc">Konstantin</reporter>
                        <labels>
                    </labels>
                <created>Mon, 19 Mar 2012 21:11:04 +0000</created>
                <updated>Thu, 19 Apr 2012 09:15:57 +0000</updated>
                                    <version>2.2.1</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>5</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="17866" author="dynom" created="Thu, 19 Apr 2012 07:46:36 +0000"  >&lt;p&gt;I don&apos;t think it should be limited to the flush method, however, as this can occur with &quot;custom&quot; queries also. It would be ideal if the errors being generated can be much more easily (read: standardized) caught or read. &lt;/p&gt;

&lt;p&gt;I&apos;m in favor of letting the database handle integrity checks, and not run a query to decide wether or not the update or insert queries will violate. Hence the desire to handle this more gracefully.&lt;/p&gt;</comment>
                    <comment id="17867" author="lucasvanlierop" created="Thu, 19 Apr 2012 09:15:57 +0000"  >&lt;p&gt;The DBAL statement class (&lt;a href=&quot;https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Statement.php&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Statement.php&lt;/a&gt;) has and execute method which might be a good place to catch and convert the generic PDOExceptions by wrapping the line&lt;/p&gt;

&lt;p&gt;$stmt = $this-&amp;gt;stmt-&amp;gt;execute($params);&lt;/p&gt;

&lt;p&gt;in a try/catch statement which then calls some kind of PDOException to Doctrine Exception method&lt;/p&gt;




</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1675] PDO::FETCH_GROUP</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1675</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;PDO supports grouping by a field when doing a fetchAll() by using PDO::FETCH_GROUP. This can in many places be useful. &lt;a href=&quot;http://blog.stealth35.com/2011/08/17/pdo-fetch-group.html&quot; class=&quot;external-link&quot;&gt;http://blog.stealth35.com/2011/08/17/pdo-fetch-group.html&lt;/a&gt; desribes the behavior quite well.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13486">DDC-1675</key>
            <summary>PDO::FETCH_GROUP</summary>
                <type id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/newfeature.png">New Feature</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="henrikbjorn">Henrik Bjornskov</reporter>
                        <labels>
                    </labels>
                <created>Thu, 1 Mar 2012 19:50:34 +0000</created>
                <updated>Thu, 1 Mar 2012 19:50:34 +0000</updated>
                                                                    <component>DQL</component>
                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-17] Ability to skip the operation from a pre-operation event handler</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-17</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;In Doctrine 1.1 it is possible to skip the operation in the event handlers in Doctrine_Record_Listener using Doctrine_Event::skipOperation.&lt;/p&gt;

&lt;p&gt;This no longer seems to be possible in Doctrine 2.0 Alpha 1, for example when handling a preRemove event to implement soft-delete behaviour. Perhaps a method could be added to \Doctrine\Common\EventArgs\LifecycleEventArgs to skip the operation, at least before the operation.&lt;/p&gt;

&lt;p&gt;Without this implementing soft-delete would require the user to update deleted_at and deleted_by himself and then save the record. It could no longer be done automatically when removing a record because the record is then removed.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10089">DDC-17</key>
            <summary>Ability to skip the operation from a pre-operation event handler</summary>
                <type id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/newfeature.png">New Feature</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="itoijala">Ismo Toijala</reporter>
                        <labels>
                    </labels>
                <created>Sun, 20 Sep 2009 17:09:23 +0000</created>
                <updated>Thu, 26 Aug 2010 08:03:54 +0000</updated>
                                                    <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="10095" author="romanb" created="Sun, 20 Sep 2009 19:46:03 +0000"  >&lt;p&gt;The problem is, full support for soft-delete throughout the system is not feasible and very fragile. Simple soft-delete through skipping the delete operation is the easiest part. Then you will probably want to modify all DQL queries so that they adhere to it automatically and then there will always be still queries that do NOT go through DQL, like even internal lazy-load queries or native queries or others, which would need to be modified also.&lt;/p&gt;

&lt;p&gt;To sum it up, implementing soft-delete &quot;inside&quot; doctrine is absolutely not worth the effort and imho a bad idea and I&apos;m certainly not willing to make lots of adjustments to the core that have a negative impact on performance just to make this soft-delete possible.&lt;/p&gt;

&lt;p&gt;I really recommend handling &quot;soft&quot; deletes yourself, the normal way, by simply abstracting entity retrieval and persistence through a DAO/repository layer. As a nice side-effect you get less magic and it still works when you swap out doctrine for another persistence provider.&lt;/p&gt;

&lt;p&gt;I am willing to add support for skipping deletes and maybe some other operations through events but I&apos;m not willing to go any further, as explained above.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-547] Consider allowing custom PersistentCollection implementations</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-547</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;We should consider allowing the configuration of custom PersistentCollection implementations on a per-association basis.&lt;br/&gt;
This could allow users to craft optimized (SQL) behavior for for some of their collections to improve performance without changing the domain model code.&lt;/p&gt;

&lt;p&gt;For this, PersistentCollection needs to be designed for inheritance.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11278">DDC-547</key>
            <summary>Consider allowing custom PersistentCollection implementations</summary>
                <type id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/newfeature.png">New Feature</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="romanb">Roman S. Borschel</reporter>
                        <labels>
                    </labels>
                <created>Tue, 27 Apr 2010 11:39:21 +0000</created>
                <updated>Fri, 24 Dec 2010 05:10:38 +0000</updated>
                                    <version>2.0-BETA1</version>
                                <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>6</votes>
                        <watches>6</watches>
                        <comments>
                    <comment id="14082" author="romanb" created="Thu, 26 Aug 2010 08:03:27 +0000"  >&lt;p&gt;Rescheduled for 2.1. Might be 2.x.&lt;/p&gt;</comment>
                    <comment id="15010" author="beberlei" created="Fri, 24 Dec 2010 05:10:38 +0000"  >&lt;p&gt;Reschedule for 2.x&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-530] Create tests and documentation for possibilities of mixing inheritance mapping strategies</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-530</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;It is (theoretically) possible to use different inheritance mapping strategies in the same class hierarchy as long as the different subtrees that use different mapping strategies do not have a common ancestor entity. We should add some tests for that and mention it in the docs about inheritance mapping in a new subsection &quot;Mixing Inheritance Mapping Strategies&quot;.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11244">DDC-530</key>
            <summary>Create tests and documentation for possibilities of mixing inheritance mapping strategies</summary>
                <type id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/task.png">Task</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="romanb">Roman S. Borschel</reporter>
                        <labels>
                    </labels>
                <created>Mon, 19 Apr 2010 05:37:55 +0000</created>
                <updated>Mon, 19 Apr 2010 05:37:55 +0000</updated>
                                    <version>2.0-BETA1</version>
                                <fixVersion>2.0</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-450] Add TableGenerator Implementation</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-450</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;The TableGenerator Id Generator is not yet implemented, here is some code i came up with:&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 TableGenerator &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; AbstractIdGenerator
{
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $_tableName;
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $_sequenceName;
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $_allocationSize;
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $_nextValue;
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $_maxValue;

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function __construct($tableName, $sequenceName = &apos;&lt;span class=&quot;code-keyword&quot;&gt;default&lt;/span&gt;&apos;, $allocationSize = 10)
    {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_tableName = $tableName;
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_sequenceName = $sequenceName;
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_allocationSize = $allocationSize;
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function generate(EntityManager $em, $entity)
    {
        &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;_maxValue === &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt; || $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_nextValue == $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_maxValue) {
            &lt;span class=&quot;code-comment&quot;&gt;// Allocate &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; values
&lt;/span&gt;            $conn = $em-&amp;gt;getConnection();
            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($conn-&amp;gt;getTransactionNestingLevel() == 0) {

                &lt;span class=&quot;code-comment&quot;&gt;// use select &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; update
&lt;/span&gt;                $sql = $conn-&amp;gt;getDatabasePlatform()-&amp;gt;getTableHiLoCurrentValSql($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_tableName, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_sequenceName);
                $currentLevel = $conn-&amp;gt;fetchColumn($sql);
                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($currentLevel != &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;) {
                    $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_nextValue = $currentLevel;
                    $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_maxValue = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_nextValue + $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_allocationSize;

                    $updateSql = $conn-&amp;gt;getDatabasePlatform()-&amp;gt;getTableHiLoUpdateNextValSql(
                        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_tableName, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_sequenceName, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_allocationSize
                    );
                    
                    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($conn-&amp;gt;executeUpdate($updateSql, array(1 =&amp;gt; $currentLevel, 2 =&amp;gt; $currentLevel+1)) !== 1) {
                        &lt;span class=&quot;code-comment&quot;&gt;// no affected rows, concurrency issue, &lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; exception
&lt;/span&gt;                    }
                } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
                    &lt;span class=&quot;code-comment&quot;&gt;// no current level returned, TableGenerator seems to be broken, &lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; exception
&lt;/span&gt;                }
            } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
                &lt;span class=&quot;code-comment&quot;&gt;// only table locks help here, implement &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; or &lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; exception?
&lt;/span&gt;                &lt;span class=&quot;code-comment&quot;&gt;// or &lt;span class=&quot;code-keyword&quot;&gt;do&lt;/span&gt; we want to work with table locks exclusively?
&lt;/span&gt;            }
        }
        &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;_nextValue++;
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="11100">DDC-450</key>
            <summary>Add TableGenerator Implementation</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/reopened.png">Reopened</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>Sat, 20 Mar 2010 14:02:43 +0000</created>
                <updated>Mon, 13 Feb 2012 14:11:35 +0000</updated>
                                    <version>2.0-ALPHA4</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="13771" author="guilhermeblanco" created="Wed, 4 Aug 2010 00:44:41 +0000"  >&lt;p&gt;Already merged into core.&lt;/p&gt;</comment>
                    <comment id="13772" author="beberlei" created="Wed, 4 Aug 2010 03:39:01 +0000"  >&lt;p&gt;But it is not enabled yet &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; Plus we need tests to verify this works in high concurrency enviroments and does not pass the same id twice.&lt;/p&gt;

&lt;p&gt;Furthermore the DAtabase Platform Methods are completly missing. No implementations yet.&lt;/p&gt;</comment>
                    <comment id="13773" author="beberlei" created="Wed, 4 Aug 2010 03:39:18 +0000"  >&lt;p&gt;Schema-Tool support is also missing.&lt;/p&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10002">
                <name>Dependency</name>
                                <outwardlinks description="depends on">
                            <issuelink>
            <issuekey id="13443">DBAL-223</issuekey>
        </issuelink>
                    </outwardlinks>
                                            </issuelinktype>
                    </issuelinks>
                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-415] Introduce UnitOfWork Stages and throw exceptions for wrong method uses</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-415</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Currently the event architecture is fragile when used wrong. I already see lots of &quot;bug reports&quot; popping up on this issue due to people dont understanding what is doable and what is not.&lt;/p&gt;

&lt;p&gt;How about we introduce an instance variable stage into the UnitOfWork and introduce an assertIsInStages($stages) protected method which is called ineach major command method of the UnitOfWork to verify its applied correctly?&lt;/p&gt;

&lt;p&gt;Stages could be:&lt;/p&gt;

&lt;p&gt;UNFLUSHED&lt;br/&gt;
PRE_COMPUTE_CHANGESETS&lt;br/&gt;
POST_COMPUTE_CHANGESETS&lt;br/&gt;
FLUSH_LOOP&lt;br/&gt;
TRANSACTION_COMPLETED&lt;/p&gt;</description>
                <environment></environment>
            <key id="11039">DDC-415</key>
            <summary>Introduce UnitOfWork Stages and throw exceptions for wrong method uses</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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>Fri, 12 Mar 2010 04:20:04 +0000</created>
                <updated>Thu, 18 Mar 2010 07:47:17 +0000</updated>
                                    <version>2.0-ALPHA4</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="12105" author="romanb" created="Fri, 12 Mar 2010 04:37:59 +0000"  >&lt;p&gt;I&apos;m not sure. I&apos;m afraid this will just add code bloat with the only goal to provide better error messages and its fragile to do right. There will surely be places missed in the code where to check for the stage and it might even constrain some valid use-cases we dont think of yet.&lt;/p&gt;

&lt;p&gt;So I&apos;m afraid that this would hurt more than it would help.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-391] Allow to specifiy custom Entity and Collection Persister classes</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-391</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;It should be allowed to overwrite the default persisters for collections and entities. This should go along the lines of Hibernate which allows to set the custom implementations like:&lt;/p&gt;

&lt;p&gt;XML:&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;&amp;lt;entity persister=&lt;span class=&quot;code-quote&quot;&gt;&quot;persisterClass&quot;&lt;/span&gt; /&amp;gt;
&amp;lt;OneToMany persister=&lt;span class=&quot;code-quote&quot;&gt;&quot;persisterClass&quot;&lt;/span&gt; /&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Annotation&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;/**
 * @Entity(persister=&lt;span class=&quot;code-quote&quot;&gt;&quot;persisterClass&quot;&lt;/span&gt;)
 * @OneToMany(persister=&lt;span class=&quot;code-quote&quot;&gt;&quot;persisterClass&quot;&lt;/span&gt;)
 */
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="10999">DDC-391</key>
            <summary>Allow to specifiy custom Entity and Collection Persister classes</summary>
                <type id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/newfeature.png">New Feature</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/inprogress.png">In Progress</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="beberlei">Benjamin Eberlei</reporter>
                        <labels>
                    </labels>
                <created>Sat, 6 Mar 2010 07:07:22 +0000</created>
                <updated>Mon, 24 Sep 2012 08:30:25 +0000</updated>
                                    <version>2.0-ALPHA4</version>
                                <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>5</votes>
                        <watches>7</watches>
                        <comments>
                    <comment id="12997" author="romanb" created="Wed, 19 May 2010 06:32:18 +0000"  >&lt;p&gt;Rescheduling for beta3.&lt;/p&gt;</comment>
                    <comment id="13538" author="romanb" created="Wed, 7 Jul 2010 11:18:14 +0000"  >&lt;p&gt;Pushing back to beta4.&lt;/p&gt;</comment>
                    <comment id="13570" author="romanb" created="Mon, 12 Jul 2010 11:49:44 +0000"  >&lt;p&gt;Moved to 2.1 due to lack of time for any larger new features for 2.0.&lt;/p&gt;</comment>
                    <comment id="14559" author="beberlei" created="Wed, 13 Oct 2010 02:43:57 +0000"  >&lt;p&gt;implemented this in a feature branch for now, it really doesnt touch any other runtime code so maybe we can still merge this before RC1&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://github.com/doctrine/doctrine2/tree/OverridePersisters&quot; class=&quot;external-link&quot;&gt;http://github.com/doctrine/doctrine2/tree/OverridePersisters&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="15369" author="gediminasm" created="Fri, 25 Feb 2011 10:14:30 +0000"  >&lt;p&gt;Is this forgotten? you should merge it since it does not affect any other parts of ORM, this is a great feature&lt;/p&gt;</comment>
                    <comment id="15390" author="beberlei" created="Sat, 26 Feb 2011 08:50:32 +0000"  >&lt;p&gt;This has not been forgotten, but the Persister is due for a heavy refactoring for 2.2 probably, when we will make it use the SQL Query object that we are working on.&lt;/p&gt;

&lt;p&gt;So I cannot merge this, because the API will probably break big time.&lt;/p&gt;</comment>
                    <comment id="15500" author="jonaswouters" created="Wed, 16 Mar 2011 09:31:23 +0000"  >&lt;p&gt;Does that mean we will not see this feature before 2.2? &lt;/p&gt;</comment>
                    <comment id="15501" author="beberlei" created="Wed, 16 Mar 2011 12:15:24 +0000"  >&lt;p&gt;Yes, that is correct. I dont want to add it as experimental/undocumented feature because people will take it for granted and make us responsible for possible bc breaks.&lt;/p&gt;

&lt;p&gt;I will update the target version accordingly.&lt;/p&gt;

&lt;p&gt;Sorry for disappointing you, but this feature is fundamentally important at the core of the library. That means we have to get it right and not rush into it.&lt;/p&gt;</comment>
                    <comment id="15509" author="gediminasm" created="Thu, 17 Mar 2011 04:32:11 +0000"  >&lt;p&gt;Just as I thought that first you will want to make a query builder object for all persisters. since now they use plain sql. Thanks for all your work on this&lt;/p&gt;</comment>
                    <comment id="17218" author="adambro" created="Wed, 11 Jan 2012 13:28:00 +0000"  >&lt;p&gt;I might be mistaken, but AFAICS mentioned Persister heavy refactoring did not made through to 2.2 version. Is there any plan to have it in 2.3 or at any later stage?&lt;/p&gt;</comment>
                    <comment id="17229" author="guilhermeblanco" created="Fri, 13 Jan 2012 04:49:35 +0000"  >&lt;p&gt;@Adam I refactored all Persisters optimizing their code, but I could not complete the move from SQL string generation to Doctrine\DBAL\Query.&lt;br/&gt;
We missed it, yes. I may reschedule for 2.3&lt;/p&gt;</comment>
                    <comment id="18599" author="burnred" created="Wed, 5 Sep 2012 13:10:35 +0000"  >&lt;p&gt;Why is it still missing in 2.3? I would require this for an extension that uses its own overridden entity persister and using a custom persister is the solution that you guys recomend for not overriding the entity manager.&lt;/p&gt;</comment>
                    <comment id="18700" author="sstok" created="Sun, 23 Sep 2012 12:10:47 +0000"  >&lt;p&gt;Any change seeing this soon? I really need this for a security feature.&lt;/p&gt;

&lt;p&gt;What is making this so hard? just adding an setEntityPersister($entityName, $object) should do the trick.&lt;br/&gt;
I don&apos;t need any fancy stuff, just a way to limit the fields in the SELECT list.&lt;/p&gt;

&lt;p&gt;Edit: OK, I&apos;m shot I CAN NOT overwrite the entity manager as the UnitOfWork is private!&lt;br/&gt;
Got any other idea?&lt;/p&gt;</comment>
                    <comment id="18705" author="st_koegel" created="Mon, 24 Sep 2012 08:30:25 +0000"  >&lt;p&gt;Any chance you could add this quickly? I need this feature urgently to complete an extension using a custom persister. Thanks in advance.&lt;/p&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10001">
                <name>Reference</name>
                                                <inwardlinks description="is referenced by">
                            <issuelink>
            <issuekey id="11094">DDC-445</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="11650">DDC-699</issuekey>
        </issuelink>
                    </inwardlinks>
                            </issuelinktype>
                    </issuelinks>
                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-280] UnitOfWork changeSet population should take advantage of Comparable technique</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-280</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Currently our UnitOfWork computes the changeset by checking actual instances of Objects.&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;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unable to find source-code formatter for language: php.&lt;/span&gt; Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml&lt;/div&gt;&lt;pre&gt;&lt;span class=&quot;code-comment&quot;&gt;// UnitOfWork, lines 501-507 
&lt;/span&gt;
            foreach ($actualData as $propName =&amp;gt; $actualValue) { 
                $orgValue = isset($originalData[$propName]) ? $originalData[$propName] : &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;; 
                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (is_object($orgValue) &amp;amp;&amp;amp; $orgValue !== $actualValue) { 
                    $changeSet[$propName] = array($orgValue, $actualValue); 
                } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($orgValue != $actualValue || ($orgValue === &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt; ^ $actualValue === &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;))  
	                    $changeSet[$propName] = array($orgValue, $actualValue);
                } 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;While this is ok when you do new object assignments, it just bypass same instances of same object, since the hash is the same.&lt;br/&gt;
A user on IRC (post-o-matic) has a quite complex object logic that he would like to avoid clone and even instantiate another class.&lt;br/&gt;
I agree with him that cloning is not the ideal technique, mainly because the changeset would always compute the object (since then hashs would be different).&lt;/p&gt;

&lt;p&gt;He implemented this datatype:&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;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unable to find source-code formatter for language: php.&lt;/span&gt; Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml&lt;/div&gt;&lt;pre&gt;class EffortGraphType &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Type 
{ 
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform) 
    { 
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $platform-&amp;gt;getClobTypeDeclarationSql($fieldDeclaration); 
    } 

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function convertToPHPValue($value, AbstractPlatform $platform) 
    { 
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; EffortGraph(unserialize($value)); 
    } 

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function convertToDatabaseValue($value, AbstractPlatform $platform) 
    { 
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; serialize($value-&amp;gt;getGraphPoints()); 
    } 

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getName() 
    { 
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &apos;effort_graph&apos;; 
    } 
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I was thinking in a possible alternative and it came up to me the same basic idea we have with operators overloading OR Comparable interface of Java. I know in Java it supports way more things, but at least for this situation (as a start point) it would make developer&apos;s life easier.&lt;/p&gt;

&lt;p&gt;Basic idea is to have an interface in Doctrine\Common:&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;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unable to find source-code formatter for language: php.&lt;/span&gt; Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml&lt;/div&gt;&lt;pre&gt;namespace Doctrine\Common;

&lt;span class=&quot;code-keyword&quot;&gt;interface&lt;/span&gt; Comparable
{
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function compareTo($value);
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And update our UnitOfWork to take advantage of it:&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;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unable to find source-code formatter for language: php.&lt;/span&gt; Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml&lt;/div&gt;&lt;pre&gt;&lt;span class=&quot;code-comment&quot;&gt;// UnitOfWork, lines 501-507 
&lt;/span&gt;
            foreach ($actualData as $propName =&amp;gt; $actualValue) { 
                $orgValue = isset($originalData[$propName]) ? $originalData[$propName] : &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;; 

                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (is_object($orgValue)) { 
                    $isDiff = ($orgValue &lt;span class=&quot;code-keyword&quot;&gt;instanceof&lt;/span&gt; Doctrine\Common\Comparable) 
                        ? $orgValue-&amp;gt;compareTo($actualValue) :  ($orgValue !== $actualValue);

                    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($isDiff) {
                        $changeSet[$propName] = array($orgValue, $actualValue); 
                    }
                } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($orgValue != $actualValue || ($orgValue === &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt; ^ $actualValue === &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;))  
	                    $changeSet[$propName] = array($orgValue, $actualValue);
                } 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In this user&apos;s usecase, it&apos;d require him to update the EffortGraph class and implement Comparable interface.&lt;br/&gt;
For his specific situation, he&apos;d need to store original value and updated value, just like we do internally in UnitOfWork for Entities.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10791">DDC-280</key>
            <summary>UnitOfWork changeSet population should take advantage of Comparable technique</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="guilhermeblanco">Guilherme Blanco</reporter>
                        <labels>
                    </labels>
                <created>Wed, 27 Jan 2010 17:53:55 +0000</created>
                <updated>Fri, 4 Feb 2011 05:19:46 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="13018" author="guilhermeblanco" created="Wed, 19 May 2010 22:06:04 +0000"  >&lt;p&gt;What&apos;s the final status of this?&lt;/p&gt;

&lt;p&gt;IMHO this should be incorporated, since it adds a powerful support that users can take advantage in our Types.&lt;/p&gt;

&lt;p&gt;Cheers,&lt;/p&gt;</comment>
                    <comment id="13019" author="guilhermeblanco" created="Wed, 19 May 2010 22:06:50 +0000"  >&lt;p&gt;You&apos;re the main guy that can give a final word in this subject.&lt;/p&gt;

&lt;p&gt;I&apos;m +1 for this&lt;/p&gt;</comment>
                    <comment id="15224" author="rv4wd" created="Fri, 4 Feb 2011 03:16:36 +0000"  >&lt;p&gt;+1 for this...&lt;/p&gt;

&lt;p&gt;if you have datetimes in a table and are using the DateTime object, you end up with useless update queries, if you persist an unchanged object...&lt;/p&gt;</comment>
                    <comment id="15226" author="beberlei" created="Fri, 4 Feb 2011 04:10:02 +0000"  >&lt;p&gt;That is not true.&lt;/p&gt;</comment>
                    <comment id="15227" author="rv4wd" created="Fri, 4 Feb 2011 04:35:28 +0000"  >&lt;p&gt;Sorry, I wasn&apos;t clear.&lt;/p&gt;

&lt;p&gt;It does not happen in all cases.&lt;/p&gt;

&lt;p&gt;I have a simple object, that I save to the session. After merging it and flushing the entitiy manager, an update query is generated, which sets all the datetime fields of the object to their current value:&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;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unable to find source-code formatter for language: php.&lt;/span&gt; Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml&lt;/div&gt;&lt;pre&gt;$item = $_SESSION[&apos;item&apos;];
$item = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_em-&amp;gt;merge($item);
$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_em-&amp;gt;persist($item);
$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_em-&amp;gt;flush();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This code results in the expected SELECT query, which refreshes the item from DB, but it also results in an update query which sets the datetime of the object to the same value.&lt;br/&gt;
This query could be omitted, if I could use a comparable interface and a custom type for datetimes, which implement it.&lt;/p&gt;</comment>
                    <comment id="15228" author="beberlei" created="Fri, 4 Feb 2011 05:19:46 +0000"  >&lt;p&gt;This rather seems like a bug with the merging. Can you open up a new ticket describing this? Thank you&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-718] Bottleneck in computeAssociationChanges()?</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-718</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;It seems that since &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-600&quot; title=&quot;Persisting Entities with unmanaged related associations produces ugly notices&quot;&gt;&lt;del&gt;DDC-600&lt;/del&gt;&lt;/a&gt; computeAssociationChanges() iterate over entries of an collections, even if they are not marked as cascadePersist. For large, hydrated collections this could potentially become a bottleneck.&lt;/p&gt;

&lt;p&gt;Wouldn&apos;t it be better to save the &quot;addedEntities&quot; in an additional map inside &quot;PersistentCollection&quot; and retrieve those instead of calling $value-&amp;gt;unwrap() ?&lt;/p&gt;</description>
                <environment></environment>
            <key id="11677">DDC-718</key>
            <summary>Bottleneck in computeAssociationChanges()?</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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>Sat, 24 Jul 2010 03:58:00 +0000</created>
                <updated>Sat, 24 Jul 2010 04:52:23 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="13677" author="romanb" created="Sat, 24 Jul 2010 04:47:25 +0000"  >&lt;p&gt;Do you have any numbers to back this up? With large, hydrated collections the bottlenecks are likely elsewhere (SQL query, hydration) &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;Further, maintaining &quot;addedEntities&quot; is not as trivial as you might think. The current approach does not care about what happens in-between, it just computes a diff between the old and new state of the collection at commit time. Tracking added/removed objects as they come in and go is more cumbersome.&lt;/p&gt;</comment>
                    <comment id="13678" author="beberlei" created="Sat, 24 Jul 2010 04:51:40 +0000"  >&lt;p&gt;no numbers, i was just confused about the code, because i remembered it differently &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10001">
                <name>Reference</name>
                                <outwardlinks description="relates to">
                            <issuelink>
            <issuekey id="11386">DDC-600</issuekey>
        </issuelink>
                    </outwardlinks>
                                            </issuelinktype>
                    </issuelinks>
                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-712] allow RIGHT JOIN or specifying the root class of the hydratation tree</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-712</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Hi! Let me start by saying you guys did a great job with Doctrine 1 and that I can&apos;t wait to start using Doctrine2 &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;I will explain this feature request with an example. I have a User entity wich relates one to many to a Picture entity. Picture has a &quot; is main picture&quot; boolean field. Not all users have a main picture. I would like to be able to select all Users, each with their main picutre, if that exists, or some Null value, if it does not exists, in one query, using join. I would also like for the result collection to contain Picture entities on the first level, with the User beinng accessible as an aggregate of Picture.&lt;/p&gt;

&lt;p&gt;The way I can think doing this is by using a RIGHT or LEFT join (not INNER) as to also select Users that don&apos;t have a main picture. I can do this by selecting &lt;/p&gt;

&lt;p&gt;SELECT Picture p, p.User u FROM p RIGHT JOIN u WITH p.main=1&lt;/p&gt;

&lt;p&gt;but right joins afik are not available atm in either version of Doctrine, or by selecting&lt;/p&gt;

&lt;p&gt;SELECT User u, u.Picture p FROM u LEFT JOIN p WITH p.main=1&lt;/p&gt;

&lt;p&gt;and somehow instructing the hydrator to consider Picture as the root object for the generated object tree and User as a &quot;child&quot; of Picture. &lt;/p&gt;

&lt;p&gt;For users without a picture, the Picture object would somehow indicate it is NULL, while still holding a refference to the User.&lt;/p&gt;


&lt;p&gt;Makes sense? &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; If there is an alternate way to achieve this, please enlighten me, tough I think it would still add felxibility if we could hint the hydrator for the root object in a tree.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11667">DDC-712</key>
            <summary>allow RIGHT JOIN or specifying the root class of the hydratation tree</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="muqker">Mihai Ilinca</reporter>
                        <labels>
                    </labels>
                <created>Wed, 21 Jul 2010 17:54:44 +0000</created>
                <updated>Thu, 22 Jul 2010 12:21:11 +0000</updated>
                                                                    <component>DQL</component>
                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="13653" author="beberlei" created="Thu, 22 Jul 2010 02:56:34 +0000"  >&lt;p&gt;Why don&apos;t you model that as ManyToOne for the Main Picture and OneToMany for all pictures? Makes much more sense from an ORM perspsective, you would have your own property &quot;User::$mainPicture&quot;&lt;/p&gt;</comment>
                    <comment id="13661" author="muqker" created="Thu, 22 Jul 2010 12:21:11 +0000"  >&lt;p&gt;Thanks for the suggestion. However, this was just an example to demonstrate some lack of flexibility, I am not strictly looking for a solution to this example, but to the concept behind it. &lt;/p&gt;

&lt;p&gt;Also, how would I get the result with Picture on the top level and User aggregated to Picture with the model you suggested? Unless I am missing something, wouldn&apos;t I end up in the same situation?&lt;/p&gt;

&lt;p&gt;I can post-process the results myself and create a new collection easily, ofc, but it would be better (and more optimal) if I could tell the hydrator to do this, similar to how INDEXBY is passed as an option to the hydrator.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-4] Implement support for Concrete Table Inheritance</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-4</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;A first implementation could probably live without support for polymorphic queries (requires SQL UNIONs to be generated). &lt;/p&gt;</description>
                <environment></environment>
            <key id="10033">DDC-4</key>
            <summary>Implement support for Concrete Table Inheritance</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="romanb">Roman S. Borschel</reporter>
                        <labels>
                    </labels>
                <created>Wed, 9 Sep 2009 18:44:46 +0000</created>
                <updated>Fri, 24 Dec 2010 04:48:20 +0000</updated>
                                    <version>2.1</version>
                                <fixVersion>2.x</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2314] getResults with numeric indexes for fields</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2314</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;When executing a simple query with field names in SELECT clause, it is not possible to map field to numeric indexes.&lt;/p&gt;

&lt;p&gt;This is an example that i would imagine to be useful:&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;SELECT c.id AS 0, c.name AS 1, l.text AS 2 FROM Category c LEFT JOIN c.label l&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;Thus, the resulting results could be numeric indexed array. It is useful for many situations: when working with an API which expects such arrays, or when using &lt;tt&gt;list&lt;/tt&gt; to assign result fields to variables directly.&lt;/p&gt;

&lt;p&gt;Query::HYDRATE_SCALAR does not achieve this, as one could think at first glance.&lt;/p&gt;</description>
                <environment></environment>
            <key id="14543">DDC-2314</key>
            <summary>getResults with numeric indexes for fields</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="ninjds">Ninj</reporter>
                        <labels>
                    </labels>
                <created>Fri, 22 Feb 2013 13:27:27 +0000</created>
                <updated>Tue, 26 Feb 2013 08:36:04 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2283] Paginator with orderBy in joined data retrieve bad result</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2283</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;entity A have many entity B&lt;/p&gt;

&lt;p&gt;If DQL is something like &quot;select A, B from A join B order by A.field1, B.field2&quot;&lt;br/&gt;
Then Paginator retrieve different Id by a query like : &lt;br/&gt;
&quot;select distinct a.id, a.field1, b.field2 from ( ....) order by a.field1 ASC , b.field2 ASC limit 15 offset 0&quot;&lt;/p&gt;


&lt;p&gt;so, if a entity A have 20 entity B (and these sub-entity have all a different b.field2) then there&apos;s only 1 A retrieved &lt;/p&gt;</description>
                <environment></environment>
            <key id="14463">DDC-2283</key>
            <summary>Paginator with orderBy in joined data retrieve bad result</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="sylfel">Jean-Philippe THEVENOUX</reporter>
                        <labels>
                        <label>paginator</label>
                    </labels>
                <created>Thu, 7 Feb 2013 15:33:45 +0000</created>
                <updated>Tue, 26 Feb 2013 08:52:40 +0000</updated>
                                    <version>2.3.2</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2287] Getter/Setter: generate &quot;isEnabled()&quot; instead of &quot;getEnabled()&quot; for boolean field in entity classes</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2287</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;It would be better if doctrine generated &quot;isEnabled()&quot; instead of &quot;getEnabled()&quot; for boolean field in entity classes. Because, it is more meaningful.&lt;/p&gt;</description>
                <environment></environment>
            <key id="14467">DDC-2287</key>
            <summary>Getter/Setter: generate &quot;isEnabled()&quot; instead of &quot;getEnabled()&quot; for boolean field in entity classes</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="sukhrob">Sukhrob Khakimov</reporter>
                        <labels>
                    </labels>
                <created>Fri, 8 Feb 2013 09:36:14 +0000</created>
                <updated>Tue, 26 Feb 2013 08:50:40 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="19486" author="ocramius" created="Fri, 8 Feb 2013 09:40:45 +0000"  >&lt;p&gt;Not sure this kind of check should be handled. Starting to add all this kind of rules makes me think that it is becoming a big ball of mud&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2338] Entity with composite foreign keys identifiers should be persisted after related entities without exception</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2338</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I&apos;ve seen that when you create an entity with a composite foreign key as identifier it cannot be flushed until the related entities are already flushed to the database and not just persisted.&lt;/p&gt;

&lt;p&gt;It would be nice to let the user flush all the entities together and just INSERT first the related entities to get the ID and then use that to INSERT the entity with composite foreign keys.&lt;/p&gt;

&lt;p&gt;I&apos;m going to create a pull request with the failing test.&lt;/p&gt;</description>
                <environment>Mac OSX 10.8, php 5.4.11, doctrine git master version</environment>
            <key id="14674">DDC-2338</key>
            <summary>Entity with composite foreign keys identifiers should be persisted after related entities without exception</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="alex88">Alessandro Tagliapietra</reporter>
                        <labels>
                        <label>orm</label>
                        <label>unitofwork</label>
                    </labels>
                <created>Thu, 7 Mar 2013 09:30:41 +0000</created>
                <updated>Thu, 7 Mar 2013 09:40:20 +0000</updated>
                                    <version>Git Master</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="19817" author="alex88" created="Thu, 7 Mar 2013 09:40:20 +0000"  >&lt;p&gt;Created pull request &lt;a href=&quot;https://github.com/doctrine/doctrine2/pull/605&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/pull/605&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2347] Refresh Uniqueidentifier ID from mssql of inserted Entity in doctrine2.3</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2347</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I don&apos;t want you to report something that isn&apos;t a bug.&lt;br/&gt;
But I read about problems with doctrine2 and mssql uniqueid&apos;s.&lt;br/&gt;
So First I asked a question at stackoverflow. No one could help me, and the only one who gave me a comment thought the same then me, that it looks like a bug.&lt;/p&gt;

&lt;p&gt;If it isn&apos;t a bug I&apos;m very sorry for this issue report.&lt;/p&gt;

&lt;p&gt;Issue as reported in &lt;br/&gt;
&lt;a href=&quot;http://stackoverflow.com/questions/15368082/refresh-uniqueidentifier-id-from-mssql-of-inserted-entity-in-doctrine2&quot; class=&quot;external-link&quot;&gt;http://stackoverflow.com/questions/15368082/refresh-uniqueidentifier-id-from-mssql-of-inserted-entity-in-doctrine2&lt;/a&gt;&lt;/p&gt;</description>
                <environment>Windows Server 2008 R2, Apache 2.2, Doctrine 2.3, PHP 5.4</environment>
            <key id="14689">DDC-2347</key>
            <summary>Refresh Uniqueidentifier ID from mssql of inserted Entity in doctrine2.3</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="ok3n0b1">Lucas Senn</reporter>
                        <labels>
                        <label>dql</label>
                    </labels>
                <created>Wed, 13 Mar 2013 07:58:36 +0000</created>
                <updated>Wed, 13 Mar 2013 08:11:55 +0000</updated>
                                    <version>2.3.2</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2203] add EntityManager-&gt;getFilters()-&gt;isEnabled(&apos;filterName&apos;&apos;)</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2203</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description></description>
                <environment></environment>
            <key id="14316">DDC-2203</key>
            <summary>add EntityManager-&gt;getFilters()-&gt;isEnabled(&apos;filterName&apos;&apos;)</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="noise085">Enea Bette</reporter>
                        <labels>
                    </labels>
                <created>Mon, 17 Dec 2012 15:05:45 +0000</created>
                <updated>Mon, 1 Apr 2013 21:50:27 +0000</updated>
                                    <version>Git Master</version>
                                <fixVersion>2.4</fixVersion>
                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="19272" author="nemek_zg" created="Thu, 10 Jan 2013 15:59:21 +0000"  >&lt;p&gt;My pull request (&lt;a href=&quot;https://github.com/doctrine/doctrine2/pull/548&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/pull/548&lt;/a&gt;) contains an implementation of the method. Note that no exception is thrown if you query for the state of a non-existing filter - in such a case, &lt;tt&gt;false&lt;/tt&gt; is returned as for disabled filters.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2381] Pagination query can be simplified when simple joins are applied</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2381</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Hi.&lt;br/&gt;
In mysql db table i have &amp;gt; 200,000 items.&lt;br/&gt;
I use native doctrine pagination for paging the items list.&lt;br/&gt;
But generated query that gets ids for items list in paging works more then 150 sec on my workstation&lt;/p&gt;

&lt;p&gt;SELECT DISTINCT id0 FROM (SELECT m0_.id AS id0, m0_.title AS title1, m0_.text AS text2, m0_.price AS price3, m0_.originalPrice AS originalPrice4, m0_.condition_type AS condition_type5, m0_.image_1 AS image_16, m0_.image_2 AS image_27, m0_.image_3 AS image_38, m0_.image_4 AS image_49, m0_.image_5 AS image_510, m0_.video AS video11, m0_.contact_email AS contact_email12, m0_.contact_name AS contact_name13, m0_.contact_phone AS contact_phone14, m0_.contact_type AS contact_type15, m0_.published AS published16, m0_.type AS type17, m0_.status AS status18, m0_.highlight AS highlight19, m0_.urgent AS urgent20, m0_.topads AS topads21, m0_.period AS period22, m0_.hits AS hits23, m0_.ip AS ip24, m0_.created_at AS created_at25, m0_.updated_at AS updated_at26 FROM milla_message m0_ INNER JOIN milla_currency m1_ ON m0_.currency_id = m1_.id INNER JOIN milla_category m2_ ON m0_.category_id = m2_.id INNER JOIN milla_region m3_ ON m0_.region_id = m3_.id INNER JOIN milla_city m4_ ON m0_.city_id = m4_.id WHERE m0_.status = 1 ORDER BY m0_.published DESC) dctrn_result LIMIT 20 OFFSET 0&lt;/p&gt;

&lt;p&gt;source code&lt;br/&gt;
&lt;a href=&quot;https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php#L141&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php#L141&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;why SELECT DISTINCT %s FROM (%s) dctrn_result ???&lt;br/&gt;
why not SELECT DISTINCT m0_.id AS id0 FROM milla_message m0_ WHERE m0_.status = 1 ORDER BY m0_.published DESC LIMIT 20 OFFSET 0&lt;/p&gt;</description>
                <environment></environment>
            <key id="14746">DDC-2381</key>
            <summary>Pagination query can be simplified when simple joins are applied</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="ocramius">Marco Pivetta</assignee>
                                <reporter username="sergic">Sergey Gerdel</reporter>
                        <labels>
                        <label>paginator</label>
                    </labels>
                <created>Sun, 31 Mar 2013 13:58:43 +0000</created>
                <updated>Mon, 8 Apr 2013 22:32:03 +0000</updated>
                                    <version>2.3</version>
                <version>2.4</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="19908" author="ocramius" created="Sun, 31 Mar 2013 14:09:48 +0000"  >&lt;p&gt;Not a blocker&lt;/p&gt;</comment>
                    <comment id="19909" author="ocramius" created="Sun, 31 Mar 2013 14:14:11 +0000"  >&lt;p&gt;What&apos;s the result of `EXPLAIN` on a query without the subquery?&lt;/p&gt;</comment>
                    <comment id="19910" author="sergic" created="Sun, 31 Mar 2013 14:52:02 +0000"  >&lt;p&gt;explain without the subquery&lt;/p&gt;</comment>
                    <comment id="19911" author="ocramius" created="Sun, 31 Mar 2013 14:56:28 +0000"  >&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=sergic&quot; class=&quot;user-hover&quot; rel=&quot;sergic&quot;&gt;Sergey Gerdel&lt;/a&gt; that&apos;s not the same query.&lt;/p&gt;</comment>
                    <comment id="19912" author="ocramius" created="Sun, 31 Mar 2013 15:09:52 +0000"  >&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=sergic&quot; class=&quot;user-hover&quot; rel=&quot;sergic&quot;&gt;Sergey Gerdel&lt;/a&gt; this is still using&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;Using index; Using temporary; Using filesort
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Check your indexes&lt;/p&gt;</comment>
                    <comment id="19913" author="sergic" created="Sun, 31 Mar 2013 20:42:19 +0000"  >&lt;p&gt;Not in the index problem&lt;/p&gt;

&lt;p&gt;SELECT DISTINCT id0 FROM (SELECT m0_.id AS id0, m0_.title AS title1, m0_.text AS text2, m0_.price AS price3, m0_.originalPrice AS originalPrice4, m0_.condition_type AS condition_type5, m0_.image_1 AS image_16, m0_.image_2 AS image_27, m0_.image_3 AS image_38, m0_.image_4 AS image_49, m0_.image_5 AS image_510, m0_.video AS video11, m0_.contact_email AS contact_email12, m0_.contact_name AS contact_name13, m0_.contact_phone AS contact_phone14, m0_.contact_type AS contact_type15, m0_.published AS published16, m0_.type AS type17, m0_.status AS status18, m0_.highlight AS highlight19, m0_.urgent AS urgent20, m0_.topads AS topads21, m0_.period AS period22, m0_.hits AS hits23, m0_.ip AS ip24, m0_.created_at AS created_at25, m0_.updated_at AS updated_at26 FROM milla_message m0_ WHERE m0_.status = 1 ORDER BY m0_.published DESC) dctrn_result LIMIT 20 OFFSET 0&lt;/p&gt;

&lt;p&gt;Time: 104.614s explain 3&lt;/p&gt;

&lt;p&gt;SELECT DISTINCT m0_.id AS id0 FROM milla_message m0_ WHERE m0_.status = 1 ORDER BY m0_.published DESC LIMIT 20 OFFSET 0; &lt;/p&gt;

&lt;p&gt;Time: 0.001s explain 4&lt;/p&gt;</comment>
                    <comment id="19914" author="ocramius" created="Mon, 1 Apr 2013 06:17:54 +0000"  >&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=sergic&quot; class=&quot;user-hover&quot; rel=&quot;sergic&quot;&gt;Sergey Gerdel&lt;/a&gt; the ORM cannot simplify a complex query that way. There may be a conditional on one of the joined results, or generally usage of one of the joined results.&lt;/p&gt;

&lt;p&gt;Things that &lt;b&gt;could&lt;/b&gt; be optimized here are:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Removal of the `ORDER BY` clause when grouping (check ORM master, I think somebody already did that)&lt;/li&gt;
	&lt;li&gt;Trying to simplify the query by doing some serious hacking on the AST.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;The problem I see here is that the chance to spawn random bugs because of the optimization is very high, and you&apos;d have to rewrite `walkSelectStatement`&lt;/p&gt;</comment>
                    <comment id="19915" author="ocramius" created="Mon, 1 Apr 2013 06:19:15 +0000"  >&lt;p&gt;Marking as improvement&lt;/p&gt;</comment>
                    <comment id="19950" author="sergic" created="Sun, 7 Apr 2013 10:52:01 +0000"  >&lt;p&gt;Minor? &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/biggrin.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;br/&gt;
i have 100 sec for this query.&lt;br/&gt;
200k items are selected for temporary table. wtf?&lt;/p&gt;

&lt;p&gt;OK. Programmers may be mistaken in parser&lt;br/&gt;
expect ORDER BY m0_.published DESC LIMIT 20 OFFSET 0) dctrn_result &lt;br/&gt;
Time: 0.001s&lt;/p&gt;

&lt;p&gt;reality ORDER BY m0_.published DESC) dctrn_result LIMIT 20 OFFSET 0&lt;/p&gt;</comment>
                    <comment id="19951" author="ocramius" created="Sun, 7 Apr 2013 11:22:41 +0000"  >&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/jira/secure/ViewProfile.jspa?name=sergic&quot; class=&quot;user-hover&quot; rel=&quot;sergic&quot;&gt;Sergey Gerdel&lt;/a&gt; this problem does not introduce security issues and can be worked around by you while using your own pagination logic. It does not stop you from doing anything, that&apos;s why it&apos;s minor. &lt;/p&gt;</comment>
                    <comment id="19965" author="sergic" created="Mon, 8 Apr 2013 22:32:03 +0000"  >&lt;p&gt;ok)&lt;br/&gt;
i have already created my own paginator.&lt;br/&gt;
at last&lt;br/&gt;
please see how to fix this problem&lt;br/&gt;
&lt;a href=&quot;https://github.com/Sergic/doctrine2/commit/2733c815387273d3bd199a68acb717e0cbc8ccfe&quot; class=&quot;external-link&quot;&gt;https://github.com/Sergic/doctrine2/commit/2733c815387273d3bd199a68acb717e0cbc8ccfe&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11514" name="EXPLAIN.htmL" size="6667" author="sergic" created="Sun, 31 Mar 2013 13:58:43 +0000" />
                    <attachment id="11515" name="EXPLAIN1.html" size="3006" author="sergic" created="Sun, 31 Mar 2013 14:51:57 +0000" />
                    <attachment id="11517" name="EXPLAIN2.html" size="4690" author="sergic" created="Sun, 31 Mar 2013 15:08:08 +0000" />
                    <attachment id="11518" name="EXPLAIN3.htm" size="4083" author="sergic" created="Sun, 31 Mar 2013 20:42:11 +0000" />
                    <attachment id="11519" name="EXPLAIN4.htm" size="3006" author="sergic" created="Sun, 31 Mar 2013 20:42:16 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-691] doctrine.readOnly query hint</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-691</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Setting such a query hint to TRUE should result in all entities being retrieved by that query to be read-only for the purposes of change-tracking. Note that the entities themselves need not necessarily be read-only in general.&lt;/p&gt;

&lt;p&gt;This feature is a flush performance tweak that can be used to query for objects but not let the returned objects run through change-tracking on flush. Any other managed objects are tracked as usual so you can do a read-only query for 100 entities and persist a new entity in the same unit of work with optimal flushing performance.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11628">DDC-691</key>
            <summary>doctrine.readOnly query hint</summary>
                <type id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/subtask_alternate.png">Sub-task</type>
                    <parent id="10612">DDC-209</parent>
                        <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="romanb">Roman S. Borschel</reporter>
                        <labels>
                    </labels>
                <created>Thu, 15 Jul 2010 10:17:19 +0000</created>
                <updated>Thu, 31 May 2012 08:16:43 +0000</updated>
                                                    <fixVersion>2.x</fixVersion>
                                <component>DQL</component>
                <component>ORM</component>
                        <due></due>
                    <votes>5</votes>
                        <watches>5</watches>
                        <comments>
                    <comment id="17106" author="koc" created="Mon, 26 Dec 2011 19:54:15 +0000"  >&lt;p&gt;Any news?&lt;br/&gt;
Why query hint? What about temporary switching like fetch mode changing via query object?&lt;/p&gt;</comment>
                    <comment id="18031" author="acid24" created="Thu, 31 May 2012 08:16:43 +0000"  >&lt;p&gt;Any news on this?&lt;/p&gt;

&lt;p&gt;I think this is a must have feature. Thanks for all your work.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1952] Add support for array parameters on the SQLFilter</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1952</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;The SQLFilter currently only accepts string parameters which would result in SQL like:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;&quot;tableAlias.column = &apos;$filterParameter&apos;&quot;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To filter an Entity that has a lifecycle, this can be usefull to filter Entities that are in a specific state, for example:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;&quot;tableAlias.state = 1&quot;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To be able to apply the filter on an Entity that can be in multiple states, it is usefull to be able to assign an array of states using setParameter:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;$allowedStates = array(1,2,3,4);
$filter-&amp;gt;setParameter(&apos;allowedStatesParam&apos;, $allowedStates);
sprintf(&quot;tableAlias.state IN (%s)&quot;, implode(&apos;,&apos;, $this-&amp;gt;getParameter(&apos;allowedStatesParam&apos;)));
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;to eventually result in:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;&quot;tableAlias.state IN (1,2,3,4)&quot;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;However, this is currently not supported, it seems to go wrong on the PDO::quote() of the parameter. The SQL works ok when setting it statically in the filter, not taking the parameter into account.&lt;/p&gt;

&lt;p&gt;It would be nice to have support for arrays on the setParameter()&lt;/p&gt;</description>
                <environment></environment>
            <key id="13888">DDC-1952</key>
            <summary>Add support for array parameters on the SQLFilter</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="holtkamp">Menno Holtkamp</reporter>
                        <labels>
                    </labels>
                <created>Fri, 27 Jul 2012 14:26:52 +0000</created>
                <updated>Fri, 27 Jul 2012 14:26:52 +0000</updated>
                                    <version>Git Master</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>3</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2454] To-Many OrderBy mechanism should allow many-to-one associations</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2454</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&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 ProductCategory
{
    /**
     * Store
     *
     * @&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; Store
     *
     * @ORM\ManyToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;Store&quot;&lt;/span&gt;)
     * @ORM\JoinColumn(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;store_id&quot;&lt;/span&gt;, referencedColumnName=&lt;span class=&quot;code-quote&quot;&gt;&quot;store_id&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $Store;

    /**
     * storeId (&lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; ordering in Product::ProductCategories only)
     *
     * @&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; integer
     *
     * @ORM\Column(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;store_id&quot;&lt;/span&gt;, type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $storeId;
...

class Product
{
    /**
     * Associated categories
     *
     * @&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; \Doctrine\Common\Collections\Collection
     *
     * @ORM\OneToMany(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;ProductCategory&quot;&lt;/span&gt;, mappedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;Product&quot;&lt;/span&gt;)
     * @ORM\OrderBy({&lt;span class=&quot;code-quote&quot;&gt;&quot;storeId&quot;&lt;/span&gt;=&lt;span class=&quot;code-quote&quot;&gt;&quot;ASC&quot;&lt;/span&gt;})
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $ProductCategories;
}
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;If it is possible now to sort the ProductCategories collection by the storeId field, it should also be possible to sort them by the Store association. Currently a set of two fields is required: Store as a regular Many-To-One association and if a need arises to be able to use it to sort the One-To-Many collections then storeId needs to be added to the ProductCategory entity. In that case the ProductCategory entity does not pass the schema validation but is perfectly usable.&lt;/p&gt;

&lt;p&gt;This should be allowed:&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 Product
{
    /**
     * Associated categories
     *
     * @&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; \Doctrine\Common\Collections\Collection
     *
     * @ORM\OneToMany(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;ProductCategory&quot;&lt;/span&gt;, mappedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;Product&quot;&lt;/span&gt;)
     * @ORM\OrderBy({&lt;span class=&quot;code-quote&quot;&gt;&quot;Store&quot;&lt;/span&gt;=&lt;span class=&quot;code-quote&quot;&gt;&quot;ASC&quot;&lt;/span&gt;})
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $ProductCategories;
}

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="14961">DDC-2454</key>
            <summary>To-Many OrderBy mechanism should allow many-to-one associations</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="deatheriam">Oleg Namaka</reporter>
                        <labels>
                        <label>association</label>
                        <label>orderBy</label>
                    </labels>
                <created>Thu, 16 May 2013 16:55:59 +0000</created>
                <updated>Thu, 16 May 2013 17:27:53 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-2467] Incorrect work with default values, indexes, autoincrement (patch attached)</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2467</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;If you use in your MySQL database default values, indexes or string primary key, you get incorrect mapping by mapping generator. For get it - just use in database one or more from listed abilities, generate mapping for that and then try to dump-sql with schema-tool:update.&lt;/p&gt;

&lt;p&gt;Hope you fix it. Tnx! &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/wink.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</description>
                <environment></environment>
            <key id="14982">DDC-2467</key>
            <summary>Incorrect work with default values, indexes, autoincrement (patch attached)</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="and">And</reporter>
                        <labels>
                    </labels>
                <created>Thu, 23 May 2013 07:18:52 +0000</created>
                <updated>Thu, 23 May 2013 07:33:00 +0000</updated>
                                    <version>2.3.4</version>
                                                <component>Mapping Drivers</component>
                <component>ORM</component>
                <component>Tools</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="20425" author="ocramius" created="Thu, 23 May 2013 07:33:00 +0000"  >&lt;p&gt;Marked as minor improvement - thank you for the patch!&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11610" name="ORM.patch" size="5763" author="and" created="Thu, 23 May 2013 07:18:52 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1972] Throw an exception when setting cascade options which do not exist</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1972</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I made the assumption that the way to define a cascading delete is to do (in YAML):&lt;/p&gt;

&lt;p&gt;cascade: &lt;span class=&quot;error&quot;&gt;&amp;#91;delete&amp;#93;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;When it is actually:&lt;/p&gt;

&lt;p&gt;cascade: &lt;span class=&quot;error&quot;&gt;&amp;#91;remove&amp;#93;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;It would be nice if Doctrine would throw an exception when the user sets a cascade option which does not exist.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13949">DDC-1972</key>
            <summary>Throw an exception when setting cascade options which do not exist</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/trivial.png">Trivial</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="gzankevich">George Zankevich</reporter>
                        <labels>
                    </labels>
                <created>Wed, 8 Aug 2012 15:20:03 +0000</created>
                <updated>Wed, 8 Aug 2012 15:20:03 +0000</updated>
                                    <version>2.1.6</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1614] On OneToOne mappings with Primary Key same as Foreign Key, using @Id in the foreign association does not carry over when running &quot;generate-entities&quot; with --generate-annotations=1</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1614</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;When having a OneToOne mapping that has a primary key that is the same as the foreign key, using the @Id attribute does not carry over when generating entities.&lt;/p&gt;

&lt;p&gt;Example code:&lt;/p&gt;

&lt;p&gt;class User&lt;br/&gt;
{&lt;br/&gt;
    /**&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;@Id @Column(type=&quot;integer&quot;, nullable=false, columnDefinition=&quot;INT UNSIGNED NOT NULL AUTO_INCREMENT&quot;)&lt;/li&gt;
	&lt;li&gt;@GeneratedValue(strategy=&quot;AUTO&quot;)&lt;br/&gt;
     */&lt;br/&gt;
    private $id;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;    /**&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;@OneToOne(targetEntity=&quot;User_ExtraAttrs&quot;, cascade=
{&quot;persist&quot;,&quot;remove&quot;,&quot;detach&quot;,&quot;merge&quot;,&quot;refresh&quot;}
&lt;p&gt;, mappedBy=&quot;User&quot;)&lt;/p&gt;&lt;/li&gt;
	&lt;li&gt;@JoinColumn(name=&quot;id&quot;, referencedColumnName=&quot;id&quot;)&lt;br/&gt;
     */&lt;br/&gt;
    private $UserAttrs;&lt;br/&gt;
}&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;class User_ExtraAttrs&lt;br/&gt;
{&lt;br/&gt;
    /**&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;@OneToOne(targetEntity=&quot;User&quot;, cascade=
{&quot;all&quot;}
&lt;p&gt;, inversedBy=&quot;UserAttrs&quot;)&lt;/p&gt;&lt;/li&gt;
	&lt;li&gt;@Id&lt;/li&gt;
	&lt;li&gt;@JoinColumn(name=&quot;VehicleID&quot;, referencedColumnName=&quot;VehicleID&quot;)&lt;br/&gt;
     */&lt;br/&gt;
    private $User;&lt;br/&gt;
}&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;When running &quot;doctrine orm:generate-entities --regenerate-entities=1 --generate-annotations=1&quot;, the @Id in User_ExtraAttrs does not carry over.  It must be manually inserted.&lt;/p&gt;
</description>
                <environment>Fedora 15, php 5.3.8</environment>
            <key id="13379">DDC-1614</key>
            <summary>On OneToOne mappings with Primary Key same as Foreign Key, using @Id in the foreign association does not carry over when running &quot;generate-entities&quot; with --generate-annotations=1</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/trivial.png">Trivial</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="rfink">Ryan Fink</reporter>
                        <labels>
                    </labels>
                <created>Sun, 22 Jan 2012 18:11:20 +0000</created>
                <updated>Wed, 23 Jan 2013 22:32:41 +0000</updated>
                                    <version>2.1.1</version>
                                                <component>Mapping Drivers</component>
                <component>ORM</component>
                <component>Tools</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1765] SchemaTool Commands should accept both --force and --dump-sql</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1765</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;When running SchemaTool for schema operations you can get either a --dump-sql or make the changes using --force&lt;/p&gt;

&lt;p&gt;When you run with --force you get a generic &quot;1 query executed&quot; response, there should be a way to execute it receiving feedback of the queries and making the changes.&lt;/p&gt;

&lt;p&gt;This is good for example for my automated test env builder, as the return of this command would be logged. But i see no reason why the script can&apos;t take both options.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13606">DDC-1765</key>
            <summary>SchemaTool Commands should accept both --force and --dump-sql</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/trivial.png">Trivial</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="rdohms">Rafael Dohms</reporter>
                        <labels>
                    </labels>
                <created>Wed, 4 Apr 2012 15:16:27 +0000</created>
                <updated>Sat, 17 Nov 2012 15:21:38 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="19004" author="nemek_zg" created="Sat, 17 Nov 2012 15:21:38 +0000"  >&lt;p&gt;Proposed fix: &lt;a href=&quot;https://github.com/doctrine/doctrine2/pull/517&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/pull/517&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1076] It should be possible to supply EntityManager with a custom ProxyFactory</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1076</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;It is plausible that one might want to handle the loading of proxy classes in their own way, perhaps not using the filename/class scheme doctrine currently comes with.&lt;/p&gt;

&lt;p&gt;Currently the only way to provide your own implementation of ProxyFactory is to subclass EntityManager. Even this is not clean since one also must copy/paste the EntityManager::create factory method to get identical behavior.&lt;/p&gt;

&lt;p&gt;It would be nice if there was a ProxyFactory interface and one could provide an instance of it to Doctrine\ORM\Configuration when creating an EntityManager.&lt;/p&gt;
</description>
                <environment></environment>
            <key id="12493">DDC-1076</key>
            <summary>It should be possible to supply EntityManager with a custom ProxyFactory</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/trivial.png">Trivial</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="putgeminmouth">David Reisch</reporter>
                        <labels>
                    </labels>
                <created>Thu, 24 Mar 2011 15:22:14 +0000</created>
                <updated>Fri, 25 Mar 2011 10:27:07 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="15577" author="putgeminmouth" created="Thu, 24 Mar 2011 15:22:38 +0000"  >&lt;p&gt;I would be happy to contribute a patch to this end.&lt;/p&gt;</comment>
                    <comment id="15581" author="beberlei" created="Fri, 25 Mar 2011 04:26:27 +0000"  >&lt;p&gt;Can you elaborate on your use-case? proxies are sorft of a by product, to be genreated in a temporary cache directory. I don&apos;t see why one should bother about how it is done.&lt;/p&gt;</comment>
                    <comment id="15585" author="putgeminmouth" created="Fri, 25 Mar 2011 10:27:06 +0000"  >&lt;p&gt;Hi,&lt;br/&gt;
I think allowing users to specify their own implementations for things is pretty essential for a library, especially when there is no cost in complexity or implementation.&lt;/p&gt;

&lt;p&gt;Anyhow, here&apos;s my pitch:&lt;/p&gt;

&lt;p&gt;I personally do not like using inheritance for proxies (it feels hackish to me), preferring instead to have interfaces for my Business Objects which the proxies implement. To that end, I do not generate my proxies with doctrine, but maintain my own, in my code base, and the class files do not necessarily match up to the doctrine ProxyFactory&apos;s assumptions about where to find the classes.&lt;/p&gt;

&lt;p&gt;Regards,&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-605] Include Fowards Compatible Support for Scalar Type Hints Patch in ProxyFactory</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-605</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;ProxyFactory needs foward compatible support for the scalar type hint patch:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://ilia.ws/archives/217-Scalar-Type-Hints-are-Here!.html&quot; class=&quot;external-link&quot;&gt;http://ilia.ws/archives/217-Scalar-Type-Hints-are-Here!.html&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
            <key id="11399">DDC-605</key>
            <summary>Include Fowards Compatible Support for Scalar Type Hints Patch in ProxyFactory</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/trivial.png">Trivial</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>Fri, 21 May 2010 04:14:07 +0000</created>
                <updated>Sun, 8 Aug 2010 09:20:23 +0000</updated>
                                                                    <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="13051" author="romanb" created="Sun, 23 May 2010 10:13:53 +0000"  >&lt;p&gt;I would be surprised if that would not be reverted soon though &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-567] Foreign Key to Unique Field Update Failure</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-567</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I am getting an error: &apos;Notice: Undefined index: sysname in ./libraries/Doctrine/ORM/Persisters/BasicEntityPersister.php on line 434&apos; when I try to flush a change to a property that references a unique field on another object.&lt;/p&gt;

&lt;p&gt;From poking around in the _prepareUpdateData function, it seems that it only allows you to use identifier fields: &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;$newValId = $uow-&amp;gt;getEntityIdentifier($newVal);

..

$result[$owningTable][$sourceColumn] = $newValId[$targetClass-&amp;gt;fieldNames[$targetColumn]];
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I&apos;ll see if I can get a test case for this set up.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11310">DDC-567</key>
            <summary>Foreign Key to Unique Field Update Failure</summary>
                <type id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/newfeature.png">New Feature</type>
                                <priority id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/trivial.png">Trivial</priority>
                    <status id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/reopened.png">Reopened</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="romanb">Roman S. Borschel</assignee>
                                <reporter username="mridgway">Michael Ridgway</reporter>
                        <labels>
                    </labels>
                <created>Mon, 3 May 2010 10:07:03 +0000</created>
                <updated>Mon, 8 Oct 2012 14:56:08 +0000</updated>
                                    <version>2.0-BETA2</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="12821" author="romanb" created="Mon, 3 May 2010 10:25:32 +0000"  >&lt;p&gt;Hi. That is right. Foreign keys (join columns) must point to primary keys, not arbitrary other columns, whether they&apos;re unique or not, Doctrine does not know.&lt;/p&gt;

&lt;p&gt;In other words, joinColumn must always refer to an identifier/pk. I&apos;m not sure but I think anything else would be a pretty strange relational model, too, but there may be usecases we have not yet encountered.&lt;/p&gt;

&lt;p&gt;I&apos;m afraid this will not be possible and would be very hard to implement. Of course if somebody has a patch we happily accept it (after reviewing).&lt;/p&gt;

&lt;p&gt;Leaving this open in the case somebody wants to work on it.&lt;/p&gt;</comment>
                    <comment id="12822" author="mridgway" created="Mon, 3 May 2010 10:25:48 +0000"  >&lt;p&gt;A minimal test case.  Removing the first flush produces the same error, so this seems to be a bug on inserts as well.&lt;/p&gt;</comment>
                    <comment id="12823" author="romanb" created="Mon, 3 May 2010 10:27:10 +0000"  >&lt;p&gt;Its not really a bug but rather a new feature &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; This was not intended to work so far.&lt;/p&gt;</comment>
                    <comment id="12824" author="mridgway" created="Mon, 3 May 2010 10:39:51 +0000"  >&lt;p&gt;Ah, ok.  Maybe it didn&apos;t work before. I don&apos;t know where I got the idea that it did.&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;</comment>
                    <comment id="12825" author="mridgway" created="Mon, 3 May 2010 10:40:55 +0000"  >&lt;p&gt;Oops, closed it before I noticed you said you wanted to leave it open.&lt;/p&gt;</comment>
                    <comment id="12826" author="romanb" created="Mon, 3 May 2010 10:50:32 +0000"  >&lt;p&gt;Thanks for the testcase though, it is useful. In your concrete example, is it not an option to make the sysname the @Id ?&lt;/p&gt;</comment>
                    <comment id="12827" author="mridgway" created="Mon, 3 May 2010 10:59:37 +0000"  >&lt;p&gt;Yes.  That is definitely the way it should be done in this case.  I can&apos;t really think of a case to have a reference to a unique key while still having an Id on it, except when you&apos;re working with an existing, poorly designed database (which is our case).&lt;/p&gt;

&lt;p&gt;The reason I assumed this was possible is that the references actually work for lazy loading, but as soon as you start changing the references it throws this error.&lt;/p&gt;</comment>
                    <comment id="12951" author="romanb" created="Fri, 14 May 2010 08:39:11 +0000"  >&lt;p&gt;Lowering priority.&lt;/p&gt;</comment>
                    <comment id="18809" author="dready" created="Mon, 8 Oct 2012 14:56:08 +0000"  >&lt;p&gt;although we would also need this i would suggest adding an error message if the associated column is not found in $newValId. (class BasicEntityPersister.php _prepareUpdateData)&lt;/p&gt;

&lt;p&gt;otherwise the field is populated with null leaving the developer debugging an hour :-/&lt;/p&gt;

&lt;p&gt;thx&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10589" name="DDC567Test.php" size="1676" author="mridgway" created="Mon, 3 May 2010 10:25:48 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>