<!--
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Thu May 23 20:15:56 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+assignee+%3D+romanb+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+assignee+%3D+romanb+ORDER+BY+priority+DESC</link>
        <description>An XML representation of a search request</description>
                <language>en-us</language>
                        <issue start="0" end="46" total="46"/>
                <build-info>
            <version>5.2.7</version>
            <build-number>850</build-number>
            <build-date>21-02-2013</build-date>
        </build-info>
<item>
            <title>[DDC-274] Class and namespace naming inconsistency</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-274</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;There are inconsistencies with some class and namespace names that include acronyms.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;p&gt;Classes with upper-casing:&lt;br/&gt;
    ORMException, DBALException, OCI8Connection, etc.&lt;/p&gt;

&lt;p&gt;Classes with proper-casing:&lt;br/&gt;
    RunDqlTask, CliException, MySqlPlatform, etc.&lt;/p&gt;

&lt;p&gt;Namespaces with upper-casing:&lt;br/&gt;
    DBAL, ORM, Doctrine\DBAL\Driver\PDOMsSql, etc.&lt;/p&gt;

&lt;p&gt;Namespaces with proper-casing:&lt;br/&gt;
    Doctrine\Common\Cli, Doctrine\DBAL\Tools\Cli\, Doctrine\ORM\Id, etc.&lt;/p&gt;

&lt;p&gt;There is more proper-casing than upper-casing. IMHO, proper-casing is better as it&apos;s easier to read &quot;SqlException&quot; than it is to read &quot;SQLException&quot; (the &quot;E&quot; looks like part of the acronym), and things like &quot;CLITask&quot; can be avoided. &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 discussed this a bit with Benjamin and Guilherme, and they were unsure and said that the whole team needed to reach consensus.&lt;/p&gt;

&lt;p&gt;I&apos;m leaving the priority as &quot;Major&quot; because this should probably be fixed sooner rather than later to prevent compatibility breaks.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10769">DDC-274</key>
            <summary>Class and namespace naming inconsistency</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/critical.png">Critical</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="romanb">Roman S. Borschel</assignee>
                                <reporter username="darkangel">Glen Ainscow</reporter>
                        <labels>
                    </labels>
                <created>Sun, 24 Jan 2010 16:30:50 +0000</created>
                <updated>Sun, 31 Oct 2010 05:20:55 +0000</updated>
                                    <version>2.0-ALPHA4</version>
                                <fixVersion>2.0-RC1</fixVersion>
                                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="11462" author="guilhermeblanco" created="Mon, 25 Jan 2010 13:41:23 +0000"  >&lt;p&gt;Increasing the severity and adding a fix version since this MUST be fixed before next release.&lt;/p&gt;</comment>
                    <comment id="11467" author="romanb" created="Mon, 25 Jan 2010 13:57:02 +0000"  >&lt;p&gt;I find this to be of rather minor importance. You&apos;re talking of compatibility breaks, but thats only the case if we intend to start being very nitpicky about the naming in the future. We are currently not, and we wont be, so not much risk of later breakage.&lt;/p&gt;

&lt;p&gt;We have a rule of thumb already: Acronyms up to 4 characters all uppercase, otherwise normal camelcase.&lt;/p&gt;

&lt;p&gt;Now, it is often a matter of taste what is an acronym and what not and also not all acronyms have a clear casing, prime example mysql.&lt;/p&gt;

&lt;p&gt;Being too nit-picky here is just a pain in the ass and we won&apos;t reach a common consensus anyway.&lt;/p&gt;</comment>
                    <comment id="11468" author="romanb" created="Mon, 25 Jan 2010 13:58:51 +0000"  >&lt;p&gt;Oh and we better dont start arguing about whats better to read because there is no chance of agreement. If you ask me I find SQLException better than SqlException. So here we go. Lets better not run down this path.&lt;/p&gt;</comment>
                    <comment id="11469" author="darkangel" created="Mon, 25 Jan 2010 14:15:34 +0000"  >&lt;p&gt;No need to get upset, I&apos;m only trying to help.&lt;/p&gt;

&lt;p&gt;I just thought that consistency is usually a good idea, either way.&lt;/p&gt;

&lt;p&gt;I have to disagree in that an acronym is an acronym, it&apos;s not a matter of taste, the letters either stand for something, or they don&apos;t.&lt;/p&gt;

&lt;p&gt;As for &quot;mysql&quot;, only the SQL part is an acronym. So, MySQL or MySql.&lt;/p&gt;

&lt;p&gt;Close if you disagree.&lt;/p&gt;</comment>
                    <comment id="11471" author="romanb" created="Mon, 25 Jan 2010 14:28:03 +0000"  >&lt;p&gt;I&apos;m not upset. What made you think so? Maybe I should introduce a &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; every now and then.&lt;/p&gt;

&lt;p&gt;There&apos;s just no point in arguing about readability.&lt;/p&gt;

&lt;p&gt;Like I said, we do have a naming standard even if its not adhered everywhere. The standard is also not something we&apos;ve made up ourselves because we try to avoid that. When we introduced namespaces, we talked about adopting either the Java or .NET naming standards. We opted for the .NET standards. And there its recommended to write acronyms with up to 4 characters all uppercase.&lt;/p&gt;

&lt;p&gt;I dont think there are too many violations of that in the code, probably Cli =&amp;gt; CLI and some others but most of it looks ok to me.&lt;/p&gt;

&lt;p&gt;UPDATE: Maybe we can gather a list here in this ticket of violations? Cli =&amp;gt; CLI would be one. MySql =&amp;gt; MySQL another. &quot;Id&quot; is rather an abbreviation of Identifier and not an acronym, to me at least.&lt;/p&gt;</comment>
                    <comment id="11472" author="guilhermeblanco" created="Mon, 25 Jan 2010 14:29:41 +0000"  >&lt;p&gt;It&apos;s not a case of getting anyone upset...&lt;/p&gt;

&lt;p&gt;But we should fix it and keep consistency of our codebase.&lt;/p&gt;

&lt;p&gt;@romanb We should all talk and reach a common sense.&lt;br/&gt;
That&apos;s our last chance (last alpha) to get this consistency in.&lt;/p&gt;</comment>
                    <comment id="11473" author="romanb" created="Mon, 25 Jan 2010 14:33:04 +0000"  >&lt;p&gt;@Guilherme: We do have a naming standard since a year. You want to change the standard now?&lt;/p&gt;</comment>
                    <comment id="11478" author="darkangel" created="Mon, 25 Jan 2010 16:02:14 +0000"  >&lt;p&gt;@Roman,&lt;/p&gt;

&lt;p&gt;Just a feeling I got. &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;This issue was more about consistency (indicated in the title) than moving to proper-case naming.&lt;/p&gt;

&lt;p&gt;I think it might be up to 3 characters in .NET, HtmlElement, System.Linq, etc. Anyway, not important. &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 agree that Id. is an abbreviation.&lt;/p&gt;

&lt;p&gt;There are some more violations. If you decide you want to change them, let me know and I&apos;ll compile a list.&lt;/p&gt;</comment>
                    <comment id="11480" author="romanb" created="Mon, 25 Jan 2010 17:30:04 +0000"  >&lt;p&gt;@Glen: Yes, a list would be great. I find it hard to be 100% consistent sometimes though because my taste conflicts with the rule. For example, I would prefer &quot;Id&quot; over &quot;ID&quot;, especially since it comes directly after ORM &quot;Doctrine\ORM\ID\...&quot; would be a bit too much. But I would not like &quot;Orm&quot; or &quot;Dbal&quot; either. But I think in most cases we can clearly fix the inconsistency. Like CLI or MySQL or MSSQL (or should it be MsSQL?).&lt;/p&gt;

&lt;p&gt;Thanks for your help!&lt;/p&gt;

&lt;p&gt;We should probably create updated coding standards for Doctrine 2 also, since they differ quite some from Doctrine 1 due to the introduction of namespaces and such. I&apos;ll create a ticket for that.&lt;/p&gt;</comment>
                    <comment id="11481" author="darkangel" created="Mon, 25 Jan 2010 18:40:02 +0000"  >&lt;p&gt;I&apos;ll do the list for you by tomorrow at the latest, just running out of time ATM.&lt;/p&gt;

&lt;p&gt;Id is correct, as mentioned above, so that would be fine. MsSQL is correct (Ms = Microsoft = abbreviation).&lt;/p&gt;</comment>
                    <comment id="11483" author="darkangel" created="Mon, 25 Jan 2010 20:31:56 +0000"  >&lt;p&gt;Found some time ...&lt;/p&gt;

&lt;p&gt;Doctrine\Common\Cache\ApcCache -&amp;gt; APCCache&lt;br/&gt;
Doctrine\Common\Cli -&amp;gt; CLI&lt;br/&gt;
Doctrine\Common\Cli\Printers\AnsiColorPrinter -&amp;gt; ANSIColorPrinter&lt;br/&gt;
Doctrine\Common\Cli\CliController -&amp;gt; CLIController&lt;br/&gt;
Doctrine\Common\Cli\CliException -&amp;gt; CLIException&lt;/p&gt;

&lt;p&gt;Doctrine\DBAL\Driver\PDOMsSql -&amp;gt; PDOMsSQL&lt;br/&gt;
Doctrine\DBAL\Driver\PDOMySql -&amp;gt; PDOMySQL&lt;br/&gt;
Doctrine\DBAL\Driver\PDOPgSql -&amp;gt; PDOPgSQL&lt;br/&gt;
Doctrine\DBAL\Driver\PDOSqlite -&amp;gt; PDOSQLite&lt;br/&gt;
Doctrine\DBAL\Logging\EchoSqlLogger -&amp;gt; EchoSQLLogger&lt;br/&gt;
Doctrine\DBAL\Logging\SqlLogger -&amp;gt; SQLLogger&lt;br/&gt;
Doctrine\DBAL\Platforms\MsSqlPlatform -&amp;gt; MsSQLPlatform&lt;br/&gt;
Doctrine\DBAL\Platforms\MySqlPlatform -&amp;gt; MySQLPlatform&lt;br/&gt;
Doctrine\DBAL\Platforms\PostgreSqlPlatform -&amp;gt; PostgreSQLPlatform&lt;br/&gt;
Doctrine\DBAL\Platforms\SqlitePlatform -&amp;gt; SQLitePlatform&lt;br/&gt;
Doctrine\DBAL\Schema\Visitor\CreateSchemaSqlCollector -&amp;gt; CreateSchemaSQLCollector&lt;br/&gt;
Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector -&amp;gt; DropSchemaSQLCollector&lt;br/&gt;
Doctrine\DBAL\Schema\MsSqlSchemaManager -&amp;gt; MsSQLSchemaManager&lt;br/&gt;
Doctrine\DBAL\Schema\MySqlSchemaManager -&amp;gt; MySQLSchemaManager&lt;br/&gt;
Doctrine\DBAL\Schema\PostgreSqlSchemaManager -&amp;gt; PostgreSQLSchemaManager&lt;br/&gt;
Doctrine\DBAL\Schema\SqliteSchemaManager -&amp;gt; SQLiteSchemaManager&lt;br/&gt;
Doctrine\DBAL\Tools\Cli -&amp;gt; CLI&lt;br/&gt;
Doctrine\DBAL\Tools\Cli\Tasks\RunSqlTask -&amp;gt; RunSQLTask&lt;/p&gt;

&lt;p&gt;Doctrine\ORM\Mapping\Driver\PhpDriver -&amp;gt; PHPDriver&lt;br/&gt;
Doctrine\ORM\Mapping\Driver\XmlDriver -&amp;gt; XMLDriver&lt;br/&gt;
Doctrine\ORM\Mapping\Driver\YamlDriver -&amp;gt; YAMLDriver&lt;br/&gt;
Doctrine\ORM\Query\Exec\AbstractSqlExecutor -&amp;gt; AbstractSQLExecutor&lt;br/&gt;
(Should Doctrine\ORM\Query\Expr\Andx and Orx be AndX and OrX?)&lt;br/&gt;
Doctrine\ORM\Query\SqlWalker -&amp;gt; SQLWalker&lt;br/&gt;
Doctrine\ORM\Tools\Cli -&amp;gt; CLI&lt;br/&gt;
Doctrine\ORM\Tools\Cli\Tasks\RunDqlTask -&amp;gt; RunDQLTask&lt;br/&gt;
Doctrine\ORM\Tools\Export\Driver\PhpExporter -&amp;gt; PHPExporter&lt;br/&gt;
Doctrine\ORM\Tools\Export\Driver\XmlExporter -&amp;gt; XMLExporter&lt;br/&gt;
Doctrine\ORM\Tools\Export\Driver\YamlExporter -&amp;gt; YAMLExporter&lt;/p&gt;

&lt;p&gt;... I think that&apos;s it. More than you expected? I did say: &quot;There is more proper-casing than upper-casing.&quot; &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="11484" author="romanb" created="Mon, 25 Jan 2010 20:46:33 +0000"  >&lt;p&gt;No, not more than I expected. It&apos;s mostly SQL and CLI basically. Thanks for the list!&lt;/p&gt;

&lt;p&gt;We should try to go through that list before beta.&lt;/p&gt;</comment>
                    <comment id="12037" author="romanb" created="Fri, 5 Mar 2010 11:40:16 +0000"  >&lt;p&gt;Methods should be adjusted accordingly also (even though they&apos;re case insensitive). I already started with that. More to come.&lt;/p&gt;</comment>
                    <comment id="12479" author="romanb" created="Sun, 28 Mar 2010 06:19:38 +0000"  >&lt;p&gt;Most of the Cli =&amp;gt; CLI changes seem to be complete now.&lt;/p&gt;</comment>
                    <comment id="12745" author="romanb" created="Mon, 26 Apr 2010 06:06:21 +0000"  >&lt;p&gt;Pushing the rest of the name changes towards beta2.&lt;/p&gt;</comment>
                    <comment id="13007" author="romanb" created="Wed, 19 May 2010 06:58:27 +0000"  >&lt;p&gt;More renamings have been done but still more to do. Pushing remaining work to beta3.&lt;/p&gt;</comment>
                    <comment id="14152" author="romanb" created="Mon, 30 Aug 2010 06:20:35 +0000"  >&lt;p&gt;Final name changes should be done prior to going into RC1.&lt;/p&gt;</comment>
                    <comment id="14629" author="beberlei" created="Sun, 31 Oct 2010 02:36:54 +0000"  >&lt;p&gt;there is much to be done yet, however most of it is also public API class names and might cause quite some BC breaks (i.e. DBAL Platforms and Schema Manager, Mapping Driver Names). I am not sure how to proceed here.&lt;/p&gt;</comment>
                    <comment id="14642" author="romanb" created="Sun, 31 Oct 2010 05:20:55 +0000"  >&lt;p&gt;Since PHP is mostly case-insensitive on class and method names it shouldn&apos;t be much of an issue.&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-810] Issue with detaching entities and updating when using change notification</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-810</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;More information coming soon. Attaching a test case&lt;/p&gt;</description>
                <environment></environment>
            <key id="11931">DDC-810</key>
            <summary>Issue with detaching entities and updating when using change notification</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="jwage">Jonathan H. Wage</reporter>
                        <labels>
                    </labels>
                <created>Fri, 17 Sep 2010 12:43:08 +0000</created>
                <updated>Mon, 4 Jul 2011 21:47:46 +0000</updated>
                                    <version>2.0-BETA4</version>
                                <fixVersion>2.x</fixVersion>
                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="14415" author="beberlei" created="Mon, 20 Sep 2010 05:09:49 +0000"  >&lt;p&gt;From reading the issue i know what the bug is, indeed this sucks.&lt;/p&gt;</comment>
                    <comment id="14487" author="romanb" created="Tue, 28 Sep 2010 16:27:00 +0000"  >&lt;p&gt;@Jon: Any more information coming?&lt;/p&gt;

&lt;p&gt;@Benjamin: Can you summarize the essence of the issue shortly?&lt;/p&gt;</comment>
                    <comment id="14489" author="beberlei" created="Wed, 29 Sep 2010 03:02:12 +0000"  >&lt;p&gt;@Roman: The UnitOfWork (may) still be pushed as a listener into that entity, and still recieve noticies of update. Which may throw notices because the oid hashes are removed everywhere. Additionally you cant serialize the thing because you still got the UoW inside there.&lt;/p&gt;</comment>
                    <comment id="14524" author="jwage" created="Mon, 4 Oct 2010 19:48:17 +0000"  >&lt;p&gt;I don&apos;t have anymore information currently. The issue was relayed to me. I will try and find some more information and report back.&lt;/p&gt;</comment>
                    <comment id="15669" author="beberlei" created="Sun, 3 Apr 2011 14:38:51 +0000"  >&lt;p&gt;There is no way to &quot;fix&quot; this issue, i am turning it into a feature request. There needs to be a &quot;postDetach&quot; event that is triggered where the developer can detach the change notification objects.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10804" name="DDC810Test.php" size="4266" author="jwage" created="Fri, 17 Sep 2010 12:43:31 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-803] Create subselect queries within join statements</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-803</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description></description>
                <environment></environment>
            <key id="11919">DDC-803</key>
            <summary>Create subselect queries within join statements</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="martijn">Martijn Evers</reporter>
                        <labels>
                    </labels>
                <created>Tue, 14 Sep 2010 08:58:51 +0000</created>
                <updated>Tue, 14 Sep 2010 08:58:51 +0000</updated>
                                                                            <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <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-769] Disabling discriminator column in WHERE clause</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-769</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Per default Doctrine 2 adds an IN(...)-part to the query when hydrating an entity where a discriminator column is defined. While this makes sense as a default behavior, it would be pretty helpful if one could disable the WHERE-clause for discriminator columns alltogether for performance optimization.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11830">DDC-769</key>
            <summary>Disabling discriminator column in WHERE clause</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="lstrojny">Lars Strojny</reporter>
                        <labels>
                    </labels>
                <created>Thu, 26 Aug 2010 10:41:56 +0000</created>
                <updated>Tue, 7 Sep 2010 06:49:13 +0000</updated>
                                    <version>2.0-BETA3</version>
                                                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="14094" author="romanb" created="Thu, 26 Aug 2010 12:39:43 +0000"  >&lt;p&gt;That would obviously produce wrong results. Maybe you can elaborate more with an example.&lt;/p&gt;</comment>
                    <comment id="14299" author="lstrojny" created="Tue, 7 Sep 2010 06:49:13 +0000"  >&lt;p&gt;I use ENUM(&quot;foo&quot;,&quot;bar&quot;) as discriminator columns. That means, the column will contain the right values out of the box, no further result set limiting required with WHERE.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-946] Evaluate optional use of igbinary for serialization</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-946</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Igbinary is supposed to be faster and better than serialize/unserialize(). We should check if its relevant for us (metadata and query caching for example):&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/phadej/igbinary&quot; class=&quot;external-link&quot;&gt;https://github.com/phadej/igbinary&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
            <key id="12246">DDC-946</key>
            <summary>Evaluate optional use of igbinary for serialization</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>Wed, 22 Dec 2010 12:13:01 +0000</created>
                <updated>Wed, 22 Dec 2010 12:17:56 +0000</updated>
                                                                            <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="14997" author="beberlei" created="Wed, 22 Dec 2010 12:17:56 +0000"  >&lt;p&gt;&lt;a href=&quot;http://ilia.ws/archives/211-Igbinary,-The-great-serializer.html#extended&quot; class=&quot;external-link&quot;&gt;http://ilia.ws/archives/211-Igbinary,-The-great-serializer.html#extended&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-930] A table cannot have more than one many to many relationship with the same table when using reverse engineer</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-930</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;This is caused by taking the join column name as the identifier while generating a property name for annotation. The mapping driver detects that the same property is already defined and ends the convert process. A little bit smarter approach for me was to take the local table name. But this assumes a specific style of join table naming convention.&lt;/p&gt;

&lt;p&gt;Doctrine\ORM\Mapping\Driver\DatabaseDriver::loadMetadataForClass()&lt;/p&gt;

&lt;p&gt;Replace:&lt;/p&gt;

&lt;p&gt;$associationMapping&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;fieldName&amp;#39;&amp;#93;&lt;/span&gt; = Inflector::camelize(str_replace(&apos;_id&apos;, &apos;&apos;, strtolower(current($otherFk-&amp;gt;getColumns()))));&lt;/p&gt;

&lt;p&gt;With:&lt;/p&gt;

&lt;p&gt;$name = explode(&quot;_&quot;,$myFk-&amp;gt;getLocalTableName());&lt;br/&gt;
if (count($name) &amp;gt; 1)&lt;br/&gt;
{&lt;br/&gt;
	array_shift($name);&lt;br/&gt;
}&lt;br/&gt;
$name = implode(&quot;_&quot;, $name);&lt;/p&gt;

&lt;p&gt;                    $associationMapping&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;fieldName&amp;#39;&amp;#93;&lt;/span&gt; = Inflector::camelize(str_replace(&apos;_id&apos;, &apos;&apos;, strtolower($name)));&lt;/p&gt;


&lt;p&gt;Maybe to switch to this behavior with an additional option?&lt;/p&gt;</description>
                <environment>FreeBSD, PostgreSQL 8.4</environment>
            <key id="12225">DDC-930</key>
            <summary>A table cannot have more than one many to many relationship with the same table when using reverse engineer</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="teuzz">Jiri Helmich</reporter>
                        <labels>
                    </labels>
                <created>Mon, 13 Dec 2010 02:52:49 +0000</created>
                <updated>Mon, 13 Dec 2010 02:52:49 +0000</updated>
                                    <version>2.0-RC2</version>
                                                <component>Mapping Drivers</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-919] subselect</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-919</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;i&apos;d like to see more example in documentation with this subselects&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;23:08&amp;#93;&lt;/span&gt; &amp;lt;beberlei&amp;gt; can you open a tciket on jira? then i dont forget to do that when i have time&lt;/p&gt;</description>
                <environment></environment>
            <key id="12208">DDC-919</key>
            <summary>subselect</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="romanb">Roman S. Borschel</assignee>
                                <reporter username="mungiu">Mungiu Dragos</reporter>
                        <labels>
                    </labels>
                <created>Wed, 8 Dec 2010 16:16:56 +0000</created>
                <updated>Sun, 20 Mar 2011 13:45:51 +0000</updated>
                                                                    <component>Documentation</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="15543" author="lopezdonaque" created="Sun, 20 Mar 2011 13:45:51 +0000"  >&lt;p&gt;Subselect as columns or FROM clause should have mor examples.&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-213] Persist order of collections</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-213</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;A Collection is like a php array, an ordered map. Hence there should be the possibility to persist this order.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10620">DDC-213</key>
            <summary>Persist order of collections</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>Tue, 15 Dec 2009 17:40:38 +0000</created>
                <updated>Tue, 16 Oct 2012 07:43:02 +0000</updated>
                                    <version>2.0</version>
                                <fixVersion>2.x</fixVersion>
                                        <due></due>
                    <votes>10</votes>
                        <watches>8</watches>
                        <comments>
                    <comment id="13042" author="shurakai" created="Fri, 21 May 2010 19:50:28 +0000"  >&lt;p&gt;Roman, I&apos;d like to do this one as I have currently a use case for this. Do you have any idea of how to do this? What I&apos;m wondering is whether it is possible to implement this without user intervention. (This would simply mean &quot;store the entities as they were added&quot;). But this would need another column in DB that we&apos;d have to add within oneToMany / manyToMany relationships, but in this case one could save a serialized array holding &quot;entityId =&amp;gt; position&quot; key / value pairs.&lt;/p&gt;

&lt;p&gt;Afterwards, one could easily rebuild / reorder the collection via $collection-&amp;gt;set($entity, $order&lt;span class=&quot;error&quot;&gt;&amp;#91;$entity-&amp;gt;identifier&amp;#93;&lt;/span&gt;);&lt;/p&gt;

&lt;p&gt;If you&apos;ve got another thought about this, please don&apos;t hesitate to point me into the right direction!&lt;/p&gt;</comment>
                    <comment id="13043" author="beberlei" created="Sat, 22 May 2010 02:54:25 +0000"  >&lt;p&gt;this won&apos;t be implemented until 2.1, since its a pretty complex feature. &lt;/p&gt;

&lt;p&gt;Changes are probably required in:&lt;/p&gt;

&lt;p&gt;1. CollectionPersister - Add a new collection persister that takes the position into account&lt;br/&gt;
2. SchemaTool - Add a &apos;col_position&apos; column to either the many-to-many or the one-to-many tables.&lt;br/&gt;
3. EntityPersister - Use and extend current order-by support to make the sorting happen&lt;/p&gt;

&lt;p&gt;You can implement this already though with some performance hit in update scenarios. If you use the ORDER BY support and implement an API around your entity that abstracts those changes and always sets a &quot;position&quot; field on the many entity that is supposed to be sorted.&lt;/p&gt;</comment>
                    <comment id="13044" author="romanb" created="Sat, 22 May 2010 05:35:48 +0000"  >&lt;p&gt;I don&apos;t think we necessarily need a new collection persister. Simply adjusting the ManyToManyPersister to be able to deal with it might be sufficient.&lt;/p&gt;

&lt;p&gt;For OneToMany, that is always persisted from the &quot;many&quot; side, thus there is no collection persister, we would need to adjust the normal persisters.&lt;/p&gt;

&lt;p&gt;They key element for the user should be a new annotation (or corresponding xml/yaml element) @OrderColumn. By default the order should not be persistent, only when an @OrderColumn annotation is present. The name of the order column can have a default, i.e. &quot;position&quot;. Thus this enhancement of persisting the order should be fully backwards compatible.&lt;/p&gt;</comment>
                    <comment id="13045" author="romanb" created="Sat, 22 May 2010 05:41:07 +0000"  >&lt;p&gt;On another note, the getInsertDiff/getDeleteDiff methods of PersistentCollection should already be &quot;ready&quot; for this. That is, when an element in the collection changed only its position, this is already tracked as a change. However the ManyToManyPersister issues no &quot;UPDATE&quot; queries, it simply deletes and inserts. A position change may be more effectively persisted with an UPDATE.&lt;/p&gt;</comment>
                    <comment id="14493" author="beberlei" created="Thu, 30 Sep 2010 03:23:11 +0000"  >&lt;p&gt;From a mailinglist entry, required check/changepoints:&lt;/p&gt;

&lt;p&gt;1. ClassMetadata of Many-To-Many associations have to be extended to publish the required datastructure to the ORM.&lt;br/&gt;
2. All Metadata Mapping Drivers have to be extended&lt;br/&gt;
3. Persisters\ManyToManyCollectionPersister has to be extended to save the key in the many to many table if desired by the user.&lt;br/&gt;
4. Schema-Tool has to be extended to create the additional column.&lt;br/&gt;
5. PersistentCollection has to be extended so that lazy loading of collections with additional key works.&lt;br/&gt;
6. Array- and ObjectHydrator have to be extended to allow fetch join of collections with key column.&lt;br/&gt;
7. Discuss wheather to support this for One-To-Many also with the key-column on the many side. This is much more tricky internally though.&lt;/p&gt;</comment>
                    <comment id="15006" author="beberlei" created="Fri, 24 Dec 2010 04:48:03 +0000"  >&lt;p&gt;Push back to 2.x, we will have support for &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-250&quot; title=&quot;ArrayCollection Key Column @indexBy&quot;&gt;&lt;del&gt;DDC-250&lt;/del&gt;&lt;/a&gt; first and for this at a later release.&lt;/p&gt;</comment>
                    <comment id="17377" author="armetiz" created="Tue, 7 Feb 2012 17:25:33 +0000"  >&lt;p&gt;Hi there,&lt;br/&gt;
I&apos;m looking for this feature.&lt;/p&gt;

&lt;p&gt;Benjamin Eberlei said that : &quot;You can implement this already&quot;, but I don&apos;t understand the &quot;how to&quot;.&lt;/p&gt;

&lt;p&gt;Also,&lt;br/&gt;
The problem should be solve if RDBMS had a &quot;natural&quot; order. An order based on item position inside table.&lt;/p&gt;

&lt;p&gt;To get this feature without any change on Doctrine, I have remplace the PK defined by the target &amp;amp; mapped field identifier. The new PK is a new field with type &quot;integer&quot; and with auto-increment enable.&lt;br/&gt;
In this configuration, Doctrine use the &quot;natural&quot; order of the RDBMS. And I can change order of my item inside Collection and persist it.&lt;/p&gt;

&lt;p&gt;It&apos;s an very bad solution, but It work before an official support.&lt;/p&gt;

&lt;p&gt;Waiting for advices, and solutions,&lt;/p&gt;

&lt;p&gt;Thomas.&lt;/p&gt;</comment>
                    <comment id="17379" author="armetiz" created="Wed, 8 Feb 2012 10:41:00 +0000"  >&lt;p&gt;Answering to Benjamin Eberlei on the &quot;7. Discuss wheather to support this for One-To-Many also with the key-column on the many side. This is much more tricky internally though.&quot;.&lt;/p&gt;

&lt;p&gt;I think that for One-To-Many relations, if user want to store the collection order, Doctrine can store the One-To-Many as Many-To-Many with a &quot;model&quot; limitation. &lt;br/&gt;
In that case, if storing order collection for Many-To-Many work, it should work for One-To-Many.&lt;/p&gt;

&lt;p&gt;What do you think about it ?&lt;/p&gt;</comment>
                    <comment id="17486" author="ndm" created="Wed, 29 Feb 2012 05:41:55 +0000"  >&lt;p&gt;I think that it must be possible to have two keys ordering : the order isn&apos;t obligatory reversible.&lt;/p&gt;

&lt;p&gt;For exemple  with user and group : &lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;You can order groups for one user : with preference by exemple, or importance.&lt;/li&gt;
	&lt;li&gt;And  with a different order,  users for a group : rank by example.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;And maybe more, if you decide to add multi-order : an user show group by his rank in it, if his rank is identical, the order is make by love preference, and after by the importance given by the user (not necessary a number, if we imagine filter on them).&lt;/p&gt;

&lt;p&gt;So a default order can be choice with parametized fields and could 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; 
@ManyToMany(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;Group&quot;&lt;/span&gt;)
...
@JoinFields ( rank: { type: &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;} , preference:{type:&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;}, importance:{type: string, length: 40} )
@OrderByJoinFields({&lt;span class=&quot;code-quote&quot;&gt;&quot;rank&quot;&lt;/span&gt; = &lt;span class=&quot;code-quote&quot;&gt;&quot;ASC&quot;&lt;/span&gt;, &lt;span class=&quot;code-quote&quot;&gt;&quot;preference&quot;&lt;/span&gt;=&lt;span class=&quot;code-quote&quot;&gt;&quot;ASC&quot;&lt;/span&gt;, &lt;span class=&quot;code-quote&quot;&gt;&quot;importance&quot;&lt;/span&gt;=&lt;span class=&quot;code-quote&quot;&gt;&quot;ASC&quot;&lt;/span&gt; } )
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;In this case the order must be optional and would be clean if another order appears in the same scope (DQL...). And manytomany became virtual entities act as other entities except they don&apos;t appears permetting in the same time a better conception.&lt;/p&gt;

&lt;p&gt;So if the solution take in &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-181&quot; class=&quot;external-link&quot;&gt;DDC-181&lt;/a&gt; will become the only solution. This would a good idea to document this. Because, this seems to me a very important point.&lt;/p&gt;

&lt;p&gt;My last point is &lt;b&gt;even an unique ordering field&lt;/b&gt; created in the join table will be a &lt;b&gt;big and usefull improvement&lt;/b&gt;.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Thank a lot for your beautiful work.&lt;/b&gt;&lt;/p&gt;</comment>
                    <comment id="17487" author="armetiz" created="Wed, 29 Feb 2012 07:05:59 +0000"  >&lt;p&gt;In my point of view, a collection can be order in a single way only.&lt;br/&gt;
If you want to add more than one order between User &amp;amp; Group, it&apos;s a new collection, a new relation.&lt;br/&gt;
Like : &lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;User.memberOf() : Group[]&lt;/li&gt;
	&lt;li&gt;Group.members() : User[]&lt;/li&gt;
	&lt;li&gt;Group.importantMembers() : User[]&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;And it&apos;s your role to keep a consistency between members &amp;amp; importantMembers array.&lt;/p&gt;

&lt;p&gt;Because ManyToMany join table is the reflection of a state of an ArrayCollection. It&apos;s not a usefull feature to be able to store all of the state of an ArrayCollection, even the order of this Array. It&apos;s just a normal feature that is really missing &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/tongue.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;Thomas.&lt;/p&gt;</comment>
                    <comment id="17488" author="ndm" created="Wed, 29 Feb 2012 10:14:27 +0000"  >&lt;p&gt;I don&apos;t think:&lt;/p&gt;

&lt;p&gt;If you have three collection, you &lt;b&gt;duplicate one relation 3 times&lt;/b&gt; and it&apos;s easy in consequence &lt;b&gt;to lost the data integrity and unicity&lt;/b&gt;.&lt;/p&gt;

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

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Thomas have rank 10 in Admin&lt;/li&gt;
	&lt;li&gt;Thomas think the admin group has importance noted 3 on all of his groups.&lt;/li&gt;
	&lt;li&gt;If a responsable of admin group decide to delete Thomas from it.&lt;/li&gt;
	&lt;li&gt;Thomas, in his ordered list of groups, think always to be in group admin.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;So in my idea, the &lt;b&gt;many to many relation&lt;/b&gt; isn&apos;t just an array collection, but &lt;b&gt;should be an virtual entity&lt;/b&gt;. In UML or in Merise method this is a common problem to have a parametized relation. I think an orm should just implement this.&lt;/p&gt;
</comment>
                    <comment id="17489" author="armetiz" created="Wed, 29 Feb 2012 10:43:59 +0000"  >&lt;p&gt;Hum,&lt;br/&gt;
I agree with you.. In a SQL Schema, it&apos;s a good choice to add many fields in a ManyToMany join table to description &quot;order&quot;.&lt;/p&gt;</comment>
                    <comment id="17535" author="armetiz" created="Wed, 7 Mar 2012 15:12:35 +0000"  >&lt;p&gt;I just want to add a piece of Doctrine ORM Document : &lt;/p&gt;

&lt;p&gt;&quot;When working with collections, keep in mind that a Collection is essentially an &lt;b&gt;ordered map&lt;/b&gt; (just like a PHP array). That is why the remove operation accepts an index/key. removeElement is a separate method that has O ( n) complexity using array_search, where n is the size of the map.&quot;&lt;/p&gt;</comment>
                    <comment id="17636" author="armetiz" created="Fri, 23 Mar 2012 09:45:13 +0000"  >&lt;p&gt;Hi there,&lt;br/&gt;
After several discussions. on IRC, I have changed my point of view.&lt;/p&gt;

&lt;p&gt;Doctrine Documentation says : &quot;When working with collections, keep in mind that a Collection is essentially an ordered map (just like a PHP array)&quot;.&lt;br/&gt;
So, I think that Doctrine have to be able to store or not the order of a Collection. By adding a new field on the Joined table to store the position of each elements.&lt;/p&gt;

&lt;p&gt;But I not agree with @Nicolas. Because in his case, he&apos;s talking about Association Class : &lt;a href=&quot;http://etutorials.org/Programming/UML/Chapter+6.+Class+Diagrams+Advanced+Concepts/Association+Class/&quot; class=&quot;external-link&quot;&gt;http://etutorials.org/Programming/UML/Chapter+6.+Class+Diagrams+Advanced+Concepts/Association+Class/&lt;/a&gt;&lt;br/&gt;
Because he&apos;s talking of a business logic, he&apos;s talking of a dedicated Entity class.&lt;/p&gt;

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

&lt;p&gt;Thomas;&lt;/p&gt;
</comment>
                    <comment id="18593" author="armetiz" created="Fri, 31 Aug 2012 13:43:00 +0000"  >&lt;p&gt;Any news ? &lt;/p&gt;</comment>
                    <comment id="18841" author="mnapoli" created="Tue, 16 Oct 2012 07:43:02 +0000"  >&lt;p&gt;Hi, any news on this?&lt;/p&gt;

&lt;p&gt;If I may add any info to this feature request, maybe something like JPA/Hibernate could be a good start?&lt;/p&gt;

&lt;p&gt;See &lt;a href=&quot;http://docs.oracle.com/javaee/6/api/javax/persistence/OrderColumn.html&quot; class=&quot;external-link&quot;&gt;http://docs.oracle.com/javaee/6/api/javax/persistence/OrderColumn.html&lt;/a&gt; or &lt;a href=&quot;http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/collections.html#collections-indexed&quot; class=&quot;external-link&quot;&gt;http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/collections.html#collections-indexed&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The idea in Hibernate is that you persist the order of the list in an extra column. This column is not a field of the entity however.&lt;/p&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10000">
                <name>Duplicate</name>
                                                <inwardlinks description="is duplicated by">
                            <issuelink>
            <issuekey id="10523">DDC-181</issuekey>
        </issuelink>
                    </inwardlinks>
                            </issuelinktype>
                        <issuelinktype id="10001">
                <name>Reference</name>
                                                <inwardlinks description="is referenced by">
                            <issuelink>
            <issuekey id="10718">DDC-250</issuekey>
        </issuelink>
                    </inwardlinks>
                            </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-586] Repo does not find &quot;unflushed&quot; object</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-586</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;The problem is this:&lt;/p&gt;

&lt;p&gt;$bar = new \entity\content\ContentTag();&lt;br/&gt;
$bar-&amp;gt;setName(&apos;bar&apos;);&lt;br/&gt;
$em-&amp;gt;persist($bar);&lt;/p&gt;

&lt;p&gt;$existingTag = $em-&amp;gt;getRepository(&apos;entity\content\ContentTag&apos;)-&amp;gt;findOneByName(&apos;bar&apos;);&lt;/p&gt;

&lt;p&gt;Seeing as in EntityRepository &quot;find()&quot; queries the Unit of Work first, and &quot;findBy()&quot; goes directly to the persister, only remotely stored objects will be found. Now if I want a tag object to attach related tags, it would have to query by name to see if an object already exist, BUT it wont find one as the UoW has not been committed, resulting in a new one being created, ultimately resulting in a PDO error on the unique name constraint.&lt;/p&gt;

&lt;p&gt;This can be &quot;solved&quot; by inserting a flush, but it is impossible to know whether a flush is required, without knowledge of what comes next. I.e. for one part to know it has to flush, it has to know another wants to fetch an object you just created.&lt;/p&gt;

&lt;p&gt;This causes an unacceptable amount of coupling.&lt;/p&gt;

&lt;p&gt;Somehow the repo will have to be able execute DQL against the objects in the UoW.  This does not have to be full support (straight away), but it should fail (throw an exception) if the possibility exists that the UoW contains items that are excluded (e.g. the operation is not supported and the UoW still contains items).&lt;/p&gt;

&lt;p&gt;For right now, this means the EntityManager should throw an exception if DQL is executed on the type when the UoW is not empty. Until the time that the EntityManager can query the UoW using DQL. The alternative would be to &quot;flush&quot; before every operation that goes to the database for data.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11358">DDC-586</key>
            <summary>Repo does not find &quot;unflushed&quot; object</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="jkleijn">John Kleijn</reporter>
                        <labels>
                    </labels>
                <created>Fri, 14 May 2010 05:04:34 +0000</created>
                <updated>Thu, 26 Aug 2010 08:01:27 +0000</updated>
                                    <version>2.0</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="12946" author="romanb" created="Fri, 14 May 2010 07:04:31 +0000"  >&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;you mention a good point, however, this currently only affects findBy queries made through a repository. A DQL query already triggers a flush when there are pending insertions but this still has its own problems. First of, querying against the objects in the UoW is not a viable solution in my eyes.&lt;/p&gt;

&lt;p&gt;For a regular find() (by identifier) the situation is clear anyway, you &lt;b&gt;must&lt;/b&gt; flush prior to a lookup on an entity you previously persisted in the same request because, by definition, generated primary key values are only guaranteed to be available after the next flush.&lt;/p&gt;

&lt;p&gt;Automatic flushing if the UoW has pending inserts (new objects) and a query is executed (either through DQL or a repository) currently has its own set of problems, namely that it is still subject to infinite recursion if such a query is triggered in an event (listener) that executes during commit of a UoW, and secondly, that it will easily lead to double-flushes that cause unnecessary overhead (currently a flush() even if nothing needs to be done is not free because the UoW actually has to check whether nothing needs to be done). Both of these problems could be addressed with some sort of flags, but the question still is whether its not better to flush manually in the first place.&lt;br/&gt;
That would mean, in your example, you should flush after persisting the new objects, irrespectively of what code comes next, you persisted (a) new object(s) and you want to make sure these are fully available to the rest of the script.&lt;/p&gt;</comment>
                    <comment id="12947" author="romanb" created="Fri, 14 May 2010 07:13:00 +0000"  >&lt;p&gt;Furthermore, automatic flushing when there is no transaction active is probably also not a great idea, as it may split a single unit of work (that was supposed to be atomic) into 2 without the user knowing about it. So auto-flushing should better only happen when a transaction is active (i.e. explicit transaction demarcation is used).&lt;/p&gt;</comment>
                    <comment id="12948" author="jkleijn" created="Fri, 14 May 2010 07:27:40 +0000"  >&lt;p&gt;That would mean, in every example, you should flush after persisting new objects, period. If I flush in some cases and not in others, I&apos;m asking for issues that may not be caught by tests. It&apos;s an inconsistency that I personally am not comfortable with.&lt;/p&gt;

&lt;p&gt;Could be that I&apos;m overlooking something, I&apos;ve just started playing with D2.&lt;/p&gt;

&lt;p&gt;Why is querying against registered objects not viable? It&apos;s not easy, granted, but it doesn&apos;t seem impossible. There should probably be a layer between the UoW and the &quot;persisters&quot; (Data Mappers?).&lt;/p&gt;

&lt;p&gt;RE: the UoW double flush: state management on the UoW as a whole should prevent that. i.e. after a commit the whole UoW is clean? Just a suggestion, as I said, still getting my bearings.&lt;/p&gt;

&lt;p&gt;On a side note I just want to say that what I&apos;ve seen so far, for the better part, pleases me greatly. Kudos.&lt;/p&gt;</comment>
                    <comment id="12949" author="romanb" created="Fri, 14 May 2010 08:16:03 +0000"  >&lt;p&gt;@&quot;That would mean, in every example, you should flush after persisting new objects, period.&quot;&lt;/p&gt;

&lt;p&gt;Yes, if you want the objects to be visible to queries in the same request. Generally, you should flush when you complete a unit of work and that is usually not the whole request (but can be).&lt;/p&gt;

&lt;p&gt;I don&apos;t want to &quot;query&quot; against registered objects because it is a) not easy b) likely a lot of code and c) very likely error-prone. And in addition I don&apos;t see this helping with solving any inconsistency. If you want to use find() you have to flush anyway because you can not find() without having the identifier in the first place, which is only available after a flush.&lt;/p&gt;

&lt;p&gt;@RE: the UoW double flush:&lt;/p&gt;

&lt;p&gt;Yes, like I said, it can be done but it is a compromise. Having a &quot;clean/dirty&quot; flag &lt;b&gt;in addition&lt;/b&gt; to calculating the changesets of the work to do (which implicitly tells us whether the UoW is dirty) adds more code and more potential for errors. Forget to update the flag in one location and you get flushes that don&apos;t do anything, because the flag was not updated. A dirty-flag for the UoW is not really required for proper working. It is similar to the approach of maintaining a separate counter for the number of elements in a collection implementation: can make many size/count requests faster but complicates the internal implementation and increases the likelihood for errors (and lock contention for the counter in a thread-safe/concurrent implementation, an interesting case where performance goes against scalability, but I digress and that does not apply to php obviously). That said, I am not strongly opposed to doing this.&lt;/p&gt;

&lt;p&gt;If you&apos;re interested in how this is specified by &quot;big brother&quot;, take a look at section 3.8.7 of the JPA 2 specification. Shortly, with the default behavior it requires the implementation to ensure that unflushed changes are visible to queries which can be achieved by flushing these to the database automatically but &lt;b&gt;only&lt;/b&gt; if a transaction is active, otherwise the implementation must not flush to the database. There is alternatively also a &quot;MANUAL&quot; flush mode, in that case the effect of updates made to entities in the UoW upon queries is unspecified. We do not have different flush modes anymore, however, in Doctrine.&lt;/p&gt;

&lt;p&gt;So I see two possible ways to go here:&lt;/p&gt;

&lt;p&gt;1) More effort, more code, (really better?)&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Maintaining a dirty flag in the UoW (this could be done anyway at some point, even if 2) is chosen)&lt;/li&gt;
	&lt;li&gt;Maintaining a flag to avoid infinite recursion triggered from events within a UoW commit/flush&lt;/li&gt;
	&lt;li&gt;Flushing automatically when querying while there are pending inserts &lt;b&gt;and a transaction is active&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;2) No effort, less code&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Removing the current auto-flush on DQL queries which is still subject to infinite recursion&lt;/li&gt;
	&lt;li&gt;No automatic flushes, anywhere (less magic, so to speak?)&lt;/li&gt;
	&lt;li&gt;Clearly documenting that new, unflushed entities are not visible in subsequent queries issued in the same request, and if this is desired, a flush should be issued.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;That&apos;s how I see it. Now we need some votes and volunteers for the implementation &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; Personally, I am not sure yet about which version I prefer, 2) does not sound too bad for me.&lt;/p&gt;
</comment>
                    <comment id="12950" author="romanb" created="Fri, 14 May 2010 08:20:18 +0000"  >&lt;p&gt;In Nr. 1) the case with the infinite recursion may actually be more problematic. I think you simply &lt;b&gt;can not see&lt;/b&gt; unflushed new objects in queries made &lt;b&gt;during&lt;/b&gt; a UoW commit.&lt;/p&gt;</comment>
                    <comment id="12956" author="jkleijn" created="Fri, 14 May 2010 10:47:17 +0000"  >&lt;p&gt;When there&apos;s no in-memory objects inclusion, I&apos;d say 2) as well. Again, I have no idea how this is implemented currently, but I would prefer something like this:&lt;/p&gt;

&lt;p&gt;$repo-&amp;gt;start();&lt;/p&gt;

&lt;p&gt;$repo-&amp;gt;register($object);&lt;/p&gt;

&lt;p&gt;$repo-&amp;gt;commit();&lt;/p&gt;

&lt;p&gt;Why?&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Commit instead of flush: &quot;flush&quot; has little semantic value IMO, &quot;commit&quot; leaves no questions: you&apos;re committing your changes (which implies that they are not, before)&lt;/li&gt;
	&lt;li&gt;Operating on the repo leaves no question to what you are committing: changes of the associated type and relations configured to cascade, made after start()&lt;/li&gt;
	&lt;li&gt;Register instead of persist: &quot;persist&quot; is misleading as the object is not immediately persisted, and as my example shows, may not be.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;The way I see it &quot;start&quot; would create a UoW associated with the repo, &quot;commit&quot; would calculate changes and write (the enitity manager would make sure references in other UoWs are removed).&lt;/p&gt;

&lt;p&gt;Because the way it is currently implemented (or so it seems), it&apos;s unclear when to flush and when not to flush, and unclear what I&apos;m flushing at any one point in the code (because it is not locally isolated). If I have to decide whether to flush in some bit of client code, I am apparently making an assumption about the target entity, i.e. coupling.&lt;/p&gt;

&lt;p&gt;I know, you already went beta, so it&apos;s unlikely you would consider such a large change, but anyway, for your consideration.&lt;/p&gt;

&lt;p&gt;Finally, I realize I&apos;m borderline nagging now as you&apos;ve made it clear you see nothing it, but a Repository (as in the PoEAA pattern, p 322) may provide a method of fetching native in-memory objects using criteria, acting as a &quot;buffer&quot; between code and database. The Repository in D2 does effectively nothing but delegate to the UoW (or mostly to the underlying persister). Ref PoEAA 327 for an example of an in-memory strategy. As a final point of critique, the Repository does not always seem to be used as entry point for data requests, which is the whole point of the pattern. Most of what&apos;s in EntityManager, should be in EntityRepository (&quot;manager&quot; is a bit to abstract a concept to expect clear responsibilities anyway). EntityManager::find() delegates to EntityRepository, but pretty much everything else is the other way around. EntityManager would be better off named DataGateway, as that accurately describes its intended function.&lt;/p&gt;

&lt;p&gt;I admit, it would be very difficult to use DQL on in memory objects, but it would be far superior and if it work lead to much more predictable behaviour. It&apos;s the ONLY way the data store is ever going to be truly transparent. A few examples (DQL from the docs):&lt;/p&gt;

&lt;p&gt;SELECT &lt;br/&gt;
u, &lt;br/&gt;
UPPER(u.name) nameUpper &lt;br/&gt;
FROM MyProject\Model\User u&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Fetch everything from the db&lt;/li&gt;
	&lt;li&gt;Select all objects from the User UoW&lt;/li&gt;
	&lt;li&gt;Iterate over the in memory ones and &lt;b&gt;modify&lt;/b&gt; the name property to upper case&lt;/li&gt;
	&lt;li&gt;Merge the results and return&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;SELECT u FROM User u WHERE u.id = ?1 OR u.nickname LIKE ?2 ORDER BY u.surname DESC&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Execute against database&lt;/li&gt;
	&lt;li&gt;Iterate over the User UoW, indexing by &quot;surname&quot;, adding items that match the criteria&lt;/li&gt;
	&lt;li&gt;Merge the results and return&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;With joins it could get more complex, provided you want to intelligently merge results into existing objects. Question is whether that is really needed, but there&apos;s obviously a performance benefit. Actually this may already be implemented.&lt;/p&gt;

&lt;p&gt;I suspect there are edge cases, rooted in DQL still being based on SQL, but in theory it should be possible. Likely you would still want to do start(), and delegate to the driver to start an actual transaction to prevent inconsistent reads... The only way to find out if it&apos;s truly feasible is to to try it, I think.&lt;/p&gt;

&lt;p&gt;Ramble, ramble, ramble, I&apos;m done. &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; I know I seem critical, but it&apos;s positive critique, I love the direction you went with D2.&lt;/p&gt;</comment>
                    <comment id="12957" author="romanb" created="Fri, 14 May 2010 11:26:45 +0000"  >&lt;p&gt;Maybe I was not clear, with approach Nr.1 there would be in-memory objects inclusion (of new objects), in fact, there always is, due to the identity map. When you query for objects and some of them are already in memory, these are used, not again reconstructed.&lt;/p&gt;

&lt;p&gt;The EntityRepository provided by Doctrine is just a convenient mechanism for writing your own repositories. There are many different understandings for what a repository is, you can make it whatever you want it to be. Is a PoEAA repository the same as a DDD repository? Anyway, the repository could be stripped of the project, it is optional, the state management is handled by the EntityManager and UnitOfWork. These are the core components. I agree that the delegation from EntityManager#find to the repository is suboptimal in this regard and should be the other way around.&lt;/p&gt;

&lt;p&gt;Now to your question: &quot;When should I flush?&quot;. Generally, you should flush at the end of a transaction, which in turn is a unit of work. That means, use explicit transaction demarcation. begin() ... flush() commit(). I&apos;ve added some control abstractions recently that should make this even easier. I can only recommend to explicitly demarcate your transaction boundaries. As you probably know, you can not talk to your database outside of a transaction anyway. The default behavior (flush() wrapping all its stuff in a transaction) is for convenience mostly and so as not to alienate or confuse people even more who are used to autocommit mode.&lt;/p&gt;

&lt;p&gt;Concerning the naming, we mostly stick with the JPA specification and I, for one, really like the naming and I don&apos;t want to invent new names. PoEAA is far more abstract (and the examples far too specific) than what is specified in JPA, so I recommend giving that a read. The patterns in PoEAA obviously and intentionally leave a lot of room for different variants of implementation and also leave open a lot of open questions (many of the difficult questions especially, it is for a reason that the author recommends using an existing tool instead of writing your own). In my opinion it is just not feasible to query in-memory objects in a generic way, all the examples in PoEAA do not have generic but rather concrete code examples, which is obviously a lot easier. The feasible strategy, and that is what we do, is to do in-memory lookups only when querying by PK, otherwise the query is executed and afterwards nevertheless any objects reused that are already in memory (based on the PK) and not reconstructed. This is the approach we use.&lt;/p&gt;

&lt;p&gt;Thanks for your input, I do see that you are an experienced fellow in object-relational persistence, maybe we can see you as a committer some day? &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="12958" author="romanb" created="Fri, 14 May 2010 11:35:43 +0000"  >&lt;p&gt;@ &quot;SELECT u, UPPER(u.name) nameUpper FROM MyProject\Model\User u&quot;&lt;/p&gt;

&lt;p&gt;This selects all users and their names in uppercase, the uppercase names are scalar values, the users are not modified! Scalar values are separate from objects.&lt;/p&gt;

&lt;p&gt;@ &quot;... and unclear what I&apos;m flushing at any one point in the code&quot;&lt;/p&gt;

&lt;p&gt;flush() means: Synchronize the in-memory state of my objects with the database, making any changes that are only in-memory persistent. Nothing more, nothing less.&lt;/p&gt;

&lt;p&gt;Again, objects are always reused based on the identity map and the state that is in-memory prevails, unless you use refresh() or execute a query with the Query::HINT_REFRESH query hint. All objects you fetch from DQL, be it as a root object or as a joined association, are first looked up in-memory (but after the SQL query has been issued!).&lt;/p&gt;

&lt;p&gt;Maybe we have been talking past each other here, what I refer to as not feasible is querying the in-memory objects first in some way, even before the SQL query. This is just too complicated and error-prone, except for the simple case of a PK lookup and that is where we do it already.&lt;/p&gt;</comment>
                    <comment id="12959" author="jkleijn" created="Fri, 14 May 2010 12:11:07 +0000"  >&lt;p&gt;&amp;gt; Scalar values are separate from objects.&lt;/p&gt;

&lt;p&gt;Right. Bad example.&lt;/p&gt;

&lt;p&gt;&amp;gt; flush() means: Synchronize the in-memory state of my objects with the database, making any changes that are only in-memory persistent. Nothing more, nothing less.&lt;/p&gt;

&lt;p&gt;I realize that it means that, but commit() would be more obvious.&lt;/p&gt;

&lt;p&gt;&amp;gt; Maybe we have been talking past each other here, what I refer to as not feasible is querying the in-memory objects first in some way, even before the SQL query. This is just too complicated and error-prone, except for the simple case of a PK lookup and that is where we do it already.&lt;/p&gt;

&lt;p&gt;Fair enough, you don&apos;t think it&apos;s feasible, so we&apos;ll keep it at that. Maybe I&apos;ll give it a shot some time.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-536] Remove the _ prefix from private and protected members</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-536</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;The reasoning is simple: The prefix &quot;_&quot; is usually either used for easier distinction of instance variables from other, i.e. local variables, instead of always using &quot;this.&quot; (often seen in C#), or it is used to signal that a member is not meant to be accessed from outside of the class when the language does not have visibility modifiers (PHP4).&lt;/p&gt;

&lt;p&gt;Since you always have to use &quot;$this-&amp;gt;&quot; in PHP5+ when accessing instance members and there are visibility modifiers, the &quot;_&quot; is largely superfluous and just makes the verbose OO code even more verbose.&lt;/p&gt;

&lt;p&gt;Maybe the following find/replace steps will do the job almost completely:&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-quote&quot;&gt;&quot;&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $_&quot;&lt;/span&gt; =&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $&quot;&lt;/span&gt;
&lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $_&quot;&lt;/span&gt; =&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $&quot;&lt;/span&gt;
&lt;span class=&quot;code-quote&quot;&gt;&quot;$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_&quot;&lt;/span&gt; =&amp;gt; &lt;span class=&quot;code-quote&quot;&gt;&quot;$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;&quot;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="11261">DDC-536</key>
            <summary>Remove the _ prefix from private and protected members</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>
                    <security id="10000">All</security>
                        <assignee username="romanb">Roman S. Borschel</assignee>
                                <reporter username="romanb">Roman S. Borschel</reporter>
                        <labels>
                    </labels>
                <created>Fri, 23 Apr 2010 09:26:24 +0000</created>
                <updated>Fri, 19 Nov 2010 00:00:39 +0000</updated>
                                                    <fixVersion>2.0</fixVersion>
                                        <due></due>
                    <votes>1</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="12761" author="beberlei" created="Tue, 27 Apr 2010 05:50:39 +0000"  >&lt;p&gt;i just found a possible BC issue with this.&lt;/p&gt;

&lt;p&gt;EntityRepository is allowed to be extended by us, it has several variables that are underscore prefixed. How to proceed in this case?&lt;/p&gt;</comment>
                    <comment id="12762" author="romanb" created="Tue, 27 Apr 2010 05:56:06 +0000"  >&lt;p&gt;I know but its not really a problem I think. We should just decide whether we make them private in the first place and provide getters instead (which would have avoided this problem in the first place).&lt;/p&gt;</comment>
                    <comment id="12763" author="romanb" created="Tue, 27 Apr 2010 05:56:59 +0000"  >&lt;p&gt;Leaving the prefixes on the repository class only is also an option... but I dont think thats necessary.&lt;/p&gt;</comment>
                    <comment id="12764" author="beberlei" created="Tue, 27 Apr 2010 06:28:59 +0000"  >&lt;p&gt;can we commit getters for Beta 1 then? We could give everyone a period until Beta 2 to fix their code and then make the change.&lt;/p&gt;

&lt;p&gt;EntityRepository is the only class that is meant to be userland extendable to my knowledge, so this should be the only problem to adress&lt;/p&gt;</comment>
                    <comment id="12766" author="romanb" created="Tue, 27 Apr 2010 09:25:21 +0000"  >&lt;p&gt;Yes, you can add getters and commit right away if you want. Plus adding a note on the upgrade document that direct access of these properties is deprecated.&lt;/p&gt;</comment>
                    <comment id="12767" author="romanb" created="Tue, 27 Apr 2010 09:26:22 +0000"  >&lt;p&gt;Persisters will be also extensible some day in userland but they need more polish for that, I&apos;ve already started with 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;</comment>
                    <comment id="14785" author="johnnypeck" created="Fri, 19 Nov 2010 00:00:39 +0000"  >&lt;p&gt;Is this still planned? Searching the code base finds this is not being implemented. It would be a good idea to implement the change sooner than later if it will be done at all.  Also, +1 for the change. It makes complete sense.&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-682] ORACLE CHARSET DOCUMENTATION</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-682</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Openning an Oracle Database with Doctrine and Symfony doesn&apos;t  support by default utf8 charset.&lt;/p&gt;

&lt;p&gt;To support it, it is necessary to specify charset=AL32UTF8 in the dsn of the database in config/databases.yml.  Analogous to the example shown at&lt;br/&gt;
&lt;a href=&quot;http://groups.google.com/group/doctrine-user/browse_thread/thread/d0d22145d8bdc83&quot; class=&quot;external-link&quot;&gt;http://groups.google.com/group/doctrine-user/browse_thread/thread/d0d22145d8bdc83&lt;/a&gt;&lt;br/&gt;
however we have been able to use it fully only with the oracle driver (instead of oci), for example:&lt;/p&gt;

&lt;p&gt;oracle:dbname=//192.168.2.9:1521/nomina_dev;charset=AL32UTF8 &lt;/p&gt;

&lt;p&gt;Documentation by Alexia Vel&#225;squez (alexia.velasquez@hotmail.es, Vladimir T&#224;mara (vtamara@pasosdeJesus.org) and Fernando Guerrero &lt;/p&gt;</description>
                <environment>ORACLE  db  SYMFONY </environment>
            <key id="11610">DDC-682</key>
            <summary>ORACLE CHARSET DOCUMENTATION</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="jeronimo0000">fernando guerrero</reporter>
                        <labels>
                    </labels>
                <created>Sat, 10 Jul 2010 13:55:31 +0000</created>
                <updated>Sat, 10 Jul 2010 13:55:31 +0000</updated>
                                                                    <component>Documentation</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-678] OneToMany/OneToOne + onDelete=CASCADE may corrupt UoW.</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-678</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;OneToMany/OneToOne associations together with an onDelete=CASCADE schema generation hint on the @JoinColumn and appropriate foreign key constraints can potentially result in a corrupt UoW if the associated objects are already managed. We need to add tests for such scenarios and settle on a well-defined behavior in such cases.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11606">DDC-678</key>
            <summary>OneToMany/OneToOne + onDelete=CASCADE may corrupt UoW.</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="romanb">Roman S. Borschel</reporter>
                        <labels>
                    </labels>
                <created>Sat, 10 Jul 2010 07:07:01 +0000</created>
                <updated>Sun, 5 Jun 2011 15:15:44 +0000</updated>
                                                                            <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="14646" author="beberlei" created="Sun, 31 Oct 2010 07:18:22 +0000"  >&lt;p&gt;I think to preserve the semantics the following has to happen:&lt;/p&gt;

&lt;p&gt;&quot;on-delete&quot; =&amp;gt; &quot;cascade&quot; has to implicitly set cascade = remove. This hurts performance of course vs just using the on-delete, however it won&apos;t corrupt the UoW.&lt;/p&gt;</comment>
                    <comment id="15093" author="beberlei" created="Sun, 2 Jan 2011 05:21:14 +0000"  >&lt;p&gt;Not entirely would it hurt performance, you could check if on-delete =&amp;gt; cascade is set. If this is the case you wouldnt need to do an explicit remove using the UnitOfWorks cascade.&lt;/p&gt;</comment>
                    <comment id="15944" author="beberlei" created="Sun, 5 Jun 2011 15:15:44 +0000"  >&lt;p&gt;Changed to improvement&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-624] Partial object query that leaves out an association to avoid loading it fetches the association anyway.</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-624</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Assuming:&lt;/p&gt;

&lt;p&gt;Customer &amp;lt;onetoone&amp;gt; Cart&lt;/p&gt;

&lt;p&gt;where Cart is the owning side.&lt;/p&gt;

&lt;p&gt;Since the association from Customer to Cart can not be lazy, it would make sense to leave out the association in a query to avoid loading the carts 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;select partial c.{id,name, ... anything except cart} from Customer c&quot;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;But this is ignored and the carts of all customers are fetched anyway. Query::HINT_FORCE_PARTIAL_LOAD is an alternative solution, however it has the disadvantage that it disables lazy-loading for &lt;b&gt;all&lt;/b&gt; queried objects. If partial querying would honor associations this would allow more fine-grained control.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11442">DDC-624</key>
            <summary>Partial object query that leaves out an association to avoid loading it fetches the association anyway.</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="romanb">Roman S. Borschel</assignee>
                                <reporter username="romanb">Roman S. Borschel</reporter>
                        <labels>
                    </labels>
                <created>Thu, 3 Jun 2010 12:13:06 +0000</created>
                <updated>Fri, 11 Nov 2011 09:28:13 +0000</updated>
                                    <version>2.0-BETA1</version>
                                <fixVersion>2.x</fixVersion>
                                        <due></due>
                    <votes>2</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="14085" author="romanb" created="Thu, 26 Aug 2010 08:06:33 +0000"  >&lt;p&gt;Might need to be pushed back to a 2.0.x / 2.x.x bugfix release. Not clear yet.&lt;/p&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10000">
                <name>Duplicate</name>
                                                <inwardlinks description="is duplicated by">
                            <issuelink>
            <issuekey id="13141">DDC-1465</issuekey>
        </issuelink>
                    </inwardlinks>
                            </issuelinktype>
                    </issuelinks>
                <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-776] Persisters use a fixed &quot;SELECT&quot; SQL statements</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-776</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I am currently trying to work with BINARY columns with Doctrine 2 and MSSQL. In order to get my Entities working I had to create a custom Mapping Type for Binary columns. All went well in this case and I&apos;ve got it running.&lt;/p&gt;

&lt;p&gt;The problem arises when I am attempting to use Associative mapping (OneToOne/ManyToMany). The problem is, in order to do a select for an SQL column, I had to create a DQL function called &quot;CONVERT&quot; so that I use WHERE statements:&lt;/p&gt;

&lt;p&gt;            return $this-&amp;gt;createQueryBuilder(&apos;u&apos;)&lt;br/&gt;
                -&amp;gt;where(&quot;u.id = CONVERT(&apos;binary&apos;, :id, 1)&quot;)&lt;br/&gt;
                -&amp;gt;setParameter(&apos;id&apos;, $id)&lt;br/&gt;
                -&amp;gt;getQuery()&lt;br/&gt;
                -&amp;gt;getSingleResult();&lt;/p&gt;

&lt;p&gt;As you see, I must do this in order to get a result.&lt;/p&gt;

&lt;p&gt;However, when I&apos;m using associative mapping; this is what it does:&lt;/p&gt;

&lt;p&gt;        return &apos;SELECT &apos; . $this-&amp;gt;_getSelectColumnListSQL() &lt;br/&gt;
             . &apos; FROM &apos; . $this-&amp;gt;_class-&amp;gt;getQuotedTableName($this-&amp;gt;_platform) . &apos; &apos;&lt;br/&gt;
             . $this-&amp;gt;_getSQLTableAlias($this-&amp;gt;_class-&amp;gt;name)&lt;br/&gt;
             . $joinSql&lt;br/&gt;
             . ($conditionSql ? &apos; WHERE &apos; . $conditionSql : &apos;&apos;)&lt;br/&gt;
             . $orderBySql &lt;br/&gt;
             . $lockSql;&lt;/p&gt;

&lt;p&gt;As you can see, its some what hard coded and I cannot change it without changing the actual code in &lt;br/&gt;
Doctrine\ORM\Persisters\BasicEntityPersister.php&lt;/p&gt;

&lt;p&gt;So, I would first like to know if there was maybe a way you could allow us to customize the SELECT statement that the persisters use - or maybe (though I&apos;m not sure how this will be done) make them use user-defined repository functions?&lt;/p&gt;

&lt;p&gt;Like $myRepo-&amp;gt;find($identifier)&lt;/p&gt;

&lt;p&gt;Not entirely sure if I explained this properly and I do realize my circumstance is highly odd - but this does seem like a limitation and because of this I cannot use associative mapping.&lt;/p&gt;</description>
                <environment>Windows 7, Apache 2.2, MSSQL Server, PHP 5.3.3</environment>
            <key id="11845">DDC-776</key>
            <summary>Persisters use a fixed &quot;SELECT&quot; SQL statements</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="aarondm">Aaron DM</reporter>
                        <labels>
                    </labels>
                <created>Sun, 29 Aug 2010 13:52:27 +0000</created>
                <updated>Tue, 23 Apr 2013 12:09:39 +0000</updated>
                                    <version>2.0-BETA3</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="20094" author="locs" created="Tue, 23 Apr 2013 12:09:39 +0000"  >&lt;p&gt;Hi, i try to make my custom type for binary field in MSSQL.&lt;br/&gt;
I don&apos;t find own, can you please show me your custom type binary?&lt;br/&gt;
Thks a lot.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-349] Add support for specifying precedence in joins in DQL</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-349</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;This request is in followup to my doctrine-user message &quot;Doctrine 2.0: Nested joins&apos;.&lt;br/&gt;
I am a bit surprised by the responses in that defining precedences in joins by placing parenthesis around join expressions is not well-known. Although not in the original SQL92 specification it is a major and important feature offered by all the RDBMS&apos;s that Doctrine 2 supports, and oftenly performs better than using subselects or alike. Doctrine 1 did not support it, but imho Doctrine 2 should support it to be a mature allround ORM.&lt;/p&gt;

&lt;p&gt;As a short example the following is a SQL statement with a nested join, where the nesting is absolutely necessary to return only a&apos;s together with either both b&apos;s and c&apos;s or no b&apos;s and c&apos;s at all:&lt;/p&gt;

&lt;p&gt;SELECT *&lt;br/&gt;
  FROM a A&lt;br/&gt;
  LEFT JOIN (&lt;br/&gt;
    b B&lt;br/&gt;
    INNER JOIN c C ON C.b_id = B.id&lt;br/&gt;
  ) ON B.a_id = A.id&lt;/p&gt;

&lt;p&gt;In order for Doctrine 2 to support this the BNF should be something like:&lt;br/&gt;
Join ::= [&quot;LEFT&quot; &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;OUTER&amp;quot;&amp;#93;&lt;/span&gt; | &quot;INNER&quot;] &quot;JOIN&quot; ( &quot;(&quot; JoinAssociationPathExpression &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;AS&amp;quot;&amp;#93;&lt;/span&gt; AliasIdentificationVariable Join &quot;)&quot; | JoinAssociationPathExpression &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;AS&amp;quot;&amp;#93;&lt;/span&gt; AliasIdentificationVariable ) &lt;span class=&quot;error&quot;&gt;&amp;#91;(&amp;quot;ON&amp;quot; | &amp;quot;WITH&amp;quot;) ConditionalExpression&amp;#93;&lt;/span&gt;&lt;br/&gt;
instead of the current:&lt;br/&gt;
Join ::= [&quot;LEFT&quot; &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;OUTER&amp;quot;&amp;#93;&lt;/span&gt; | &quot;INNER&quot;] &quot;JOIN&quot; JoinAssociationPathExpression &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;AS&amp;quot;&amp;#93;&lt;/span&gt; AliasIdentificationVariable &lt;span class=&quot;error&quot;&gt;&amp;#91;(&amp;quot;ON&amp;quot; | &amp;quot;WITH&amp;quot;) ConditionalExpression&amp;#93;&lt;/span&gt; &lt;/p&gt;

&lt;p&gt;This would allow DQL like:&lt;/p&gt;

&lt;p&gt;SELECT A, B, C&lt;br/&gt;
  FROM a A&lt;br/&gt;
  LEFT JOIN (&lt;br/&gt;
    A.b B&lt;br/&gt;
    INNER JOIN B.c C&lt;br/&gt;
  ) WITH B.something = &apos;value&apos; AND C.something = &apos;othervalue&apos;&lt;/p&gt;

&lt;p&gt;What further needs to be done is that the DQL parser loosly couples the ConditionalExpression to any of the previously parsed JoinAssociationPathExpression&apos;s instead of tieing it explicitely to the JoinAssociationPathExpression that preceedes it according to the old BNF notation. The new BNF should however not require any changes to the hydrator. Therefore I have the feeling that improving the DQL parser for nested joins does not require extensive work, while the benefit of running these kind of queries is considerable.&lt;/p&gt;

&lt;p&gt;As an extra substantiation here are links to (BNF) FROM clause documentations of the RDBMS&apos;s that Doctrine 2 supports, they all show support for nested joins:&lt;br/&gt;
MySQL: &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/join.html&quot; class=&quot;external-link&quot;&gt;http://dev.mysql.com/doc/refman/5.0/en/join.html&lt;/a&gt;&lt;br/&gt;
PostgreSQL: &lt;a href=&quot;http://www.postgresql.org/docs/8.4/interactive/sql-select.html#SQL-FROM&quot; class=&quot;external-link&quot;&gt;http://www.postgresql.org/docs/8.4/interactive/sql-select.html#SQL-FROM&lt;/a&gt; and &lt;a href=&quot;http://www.postgresql.org/docs/8.1/interactive/explicit-joins.html&quot; class=&quot;external-link&quot;&gt;http://www.postgresql.org/docs/8.1/interactive/explicit-joins.html&lt;/a&gt;&lt;br/&gt;
MSSQL: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms177634.aspx&quot; class=&quot;external-link&quot;&gt;http://msdn.microsoft.com/en-us/library/ms177634.aspx&lt;/a&gt;&lt;br/&gt;
Oracle: &lt;a href=&quot;http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/statements_10002.htm#CHDDCHGF&quot; class=&quot;external-link&quot;&gt;http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/statements_10002.htm#CHDDCHGF&lt;/a&gt;&lt;br/&gt;
SQLite: &lt;a href=&quot;http://www.sqlite.org/syntaxdiagrams.html#single-source&quot; class=&quot;external-link&quot;&gt;http://www.sqlite.org/syntaxdiagrams.html#single-source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I surely hope you will consider implementing this improvement because it would save me and others from the hassle of writing raw SQL queries or executing multiple (thus slow) queries in DQL for doing the same. Thanks anyway for the great product so far!&lt;/p&gt;</description>
                <environment></environment>
            <key id="10915">DDC-349</key>
            <summary>Add support for specifying precedence in joins in DQL</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="dennis.verspuij">Dennis Verspuij</reporter>
                        <labels>
                    </labels>
                <created>Thu, 18 Feb 2010 09:52:45 +0000</created>
                <updated>Wed, 1 May 2013 18:46:53 +0000</updated>
                                    <version>2.0-ALPHA4</version>
                                                <component>DQL</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="12650" author="guilhermeblanco" created="Tue, 13 Apr 2010 00:04:10 +0000"  >&lt;p&gt;This seems to be a valid issue to me.&lt;/p&gt;

&lt;p&gt;This implementation is the actual solution to associations retrieval that are inherited (type joined).&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;/** Joined */
class Base {}

class Foo &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Base {}

class Bar {
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; $foo;
}

&lt;span class=&quot;code-comment&quot;&gt;// This causes the CTI to link as INNER JOIN, which makes the result become 0
&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt;// il &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; you have no Foo&apos;s defined (although it should ignore &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;)
&lt;/span&gt;$q = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_em-&amp;gt;createQuery(&apos;SELECT b, f FROM Bar b LEFT JOIN b.foo f&apos;); 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="12654" author="romanb" created="Tue, 13 Apr 2010 04:40:05 +0000"  >&lt;p&gt;Yes, this is a possible solution for &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-512&quot; title=&quot;LEFT JOIN of extended null entity cause empty result [testcase included]&quot;&gt;&lt;del&gt;DDC-512&lt;/del&gt;&lt;/a&gt; but on the &lt;b&gt;SQL level&lt;/b&gt;. I still don&apos;t see this as appropriate for DQL, it just doesnt make sense to me, DQL joins object associations, there is no precedence.&lt;/p&gt;</comment>
                    <comment id="12656" author="romanb" created="Tue, 13 Apr 2010 05:46:00 +0000"  >&lt;p&gt;So, no, this has nothing to do with &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-512&quot; title=&quot;LEFT JOIN of extended null entity cause empty result [testcase included]&quot;&gt;&lt;del&gt;DDC-512&lt;/del&gt;&lt;/a&gt;. &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-512&quot; title=&quot;LEFT JOIN of extended null entity cause empty result [testcase included]&quot;&gt;&lt;del&gt;DDC-512&lt;/del&gt;&lt;/a&gt; can even be fixed differently as outlined in my comments there.&lt;/p&gt;</comment>
                    <comment id="12657" author="romanb" created="Tue, 13 Apr 2010 05:52:20 +0000"  >&lt;p&gt;On a side note I would still like to know/see the following for this issue:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Some realisitic DQL examples where this feature would be essential, i.e. there is no other way to do it.&lt;br/&gt;
   This also means explaining what the impact on the resulting object graph is and why it makes sense.&lt;/li&gt;
	&lt;li&gt;Which other ORMs support this on the OQL/Criteria level?&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;So far, my stance on this issue is:&lt;/p&gt;

&lt;p&gt; 1) It doesnt make sense (semantically) in DQL&lt;br/&gt;
 2) Its rarely needed&lt;br/&gt;
 3) When you really need it you can use a NativeQuery anyway and use this nesting in SQL, where it probably belongs and makes more sense&lt;br/&gt;
 4) It would (unnecessarily) complicate DQL&lt;/p&gt;

&lt;p&gt;Thus I am currently leaning towards &quot;Wont fix&quot; for this issue.&lt;/p&gt;</comment>
                    <comment id="12662" author="dennis.verspuij" created="Tue, 13 Apr 2010 13:53:13 +0000"  >&lt;p&gt;Hi Roman. I understand your doubts, and I have been breaking my head over&lt;br/&gt;
creating a realistic example the last few hours that would hopefully convince&lt;br/&gt;
you for implementing this feature. But actually I cannot find one that you wouldn&apos;t&lt;br/&gt;
consider to be trivial. I do have a number of very complex optimized queries written&lt;br/&gt;
for sportskickoff dot com (using Doctrine 1.2) but they are probably hard to understand&lt;br/&gt;
because they may not be selfdescribing. Below is one example literally ripped from&lt;br/&gt;
the application. Still they often can be broken down to my example query in this&lt;br/&gt;
ticket&apos;s description, but applied grouping, additional other joins on the root component&lt;br/&gt;
and/or other criteria made them impossible to rewrite using subselects or choosing&lt;br/&gt;
another root component. Most often they just performed way best using the nested&lt;br/&gt;
syntax and saved me a number of additional queries.&lt;/p&gt;

&lt;p&gt;SELECT A.id, A.username, A.balance, COALESCE(SUM(B.stake), 0) AS sumstake, COUNT(B.id) AS nrbets&lt;br/&gt;
FROM account A&lt;br/&gt;
LEFT JOIN (&lt;br/&gt;
  bet B&lt;br/&gt;
  INNER JOIN game G ON G.id = :GAMEID AND B.timestampcompletion BETWEEN G.timestampstart AND G.timestampend&lt;br/&gt;
) ON B.accountid = A.id AND B.timestampcompletion IS NOT NULL&lt;br/&gt;
WHERE A.Status &amp;amp; :ACTIVEORDISQUALIFIED = :ACTIVE&lt;br/&gt;
GROUP BY A.id, A.username, A.balance&lt;br/&gt;
ORDER BY A.balance DESC, sumstake ASC, nrbets ASC, A.username ASC&lt;/p&gt;

&lt;p&gt;But let&apos;s put it another way. I would also like this feature to be supported in DQL&lt;br/&gt;
because I just do not want to use native queries. Why would I want to use native&lt;br/&gt;
queries if it can be done using DQL? In DQL I work with class names and field&lt;br/&gt;
names, and they may differ from the underlying table and column names. Doctrine&lt;br/&gt;
takes care of that mapping based on my schema/annotations and I do not&lt;br/&gt;
have to &quot;know&quot; these mappings. In native queries I suddenly do have to &quot;know&quot;&lt;br/&gt;
these mappings. I use Doctrine because it makes my application portable and&lt;br/&gt;
enables me to work with my database in an OOP way like I do in my model,&lt;br/&gt;
abstracting things. The need for native queries partly reverts the benefits Doctrine&lt;br/&gt;
offers in the first place.&lt;/p&gt;

&lt;p&gt;Btw, I recall to have successfully used the nested join syntax in HQL (.NET Hibernate)&lt;br/&gt;
but I cannot find examples on the web or a BNF notation.&lt;/p&gt;

&lt;p&gt;Furthermore, in reply to your stances:&lt;br/&gt;
1) It indeed doesnt make sense (semantically) in DQL, it only makes the result&lt;br/&gt;
  set different, but not the way data is hydrated into objects;&lt;br/&gt;
2) Its indeed rarely needed for inserting, updating and populating basic lists but&lt;br/&gt;
  it allows you to better select what combinations of associated rows are joined&lt;br/&gt;
  and which not in more optimized queries without having to use native queries,&lt;br/&gt;
  or because they perform better than using subseletcs and alike.&lt;br/&gt;
3) Not having to use native queries is just an extra reason for using Doctrine and&lt;br/&gt;
  maintains the abstraction the ORM provides througout on&apos;es whole application&lt;br/&gt;
4) Why would it complicate DQL, if people do not know about or understand&lt;br/&gt;
  the feature it wouldn&apos;t matter because not using parenthesises is the default&lt;br/&gt;
  way to specify joins?&lt;/p&gt;

&lt;p&gt;Well, this is it, can&apos;t find any more words to promote and make you enthusiastic.... lol.&lt;/p&gt;</comment>
                    <comment id="12663" author="dennis.verspuij" created="Tue, 13 Apr 2010 17:48:39 +0000"  >&lt;p&gt;Ok, I have not given up 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;, here&apos;s a &quot;stupid&quot; example.&lt;/p&gt;

&lt;p&gt;Imagine a book store that sells books of various authors and keeps track of those sales.&lt;br/&gt;
Let&apos;s say you would have an admin page that lists all authors, and for each author&lt;br/&gt;
its also shows the books and their sales dates since january 1st, but only for those&lt;br/&gt;
books that were actually sold and contain an A in its name. An optimized SQL query&lt;br/&gt;
to fetch all the information at once would be something like:&lt;/p&gt;

&lt;p&gt;SELECT A.&lt;b&gt;, B.&lt;/b&gt;, S.*&lt;br/&gt;
  FROM author A&lt;br/&gt;
  LEFT JOIN (&lt;br/&gt;
    book B&lt;br/&gt;
    INNER JOIN sale S ON S.book_id = B.id AND S.dt &amp;gt;= &apos;2010-01-01&apos;&lt;br/&gt;
  ) ON B.author_id = A.id AND A.name LIKE &apos;%A%&apos;&lt;/p&gt;

&lt;p&gt;In DQL it would then be something like:&lt;/p&gt;

&lt;p&gt;SELECT A.&lt;b&gt;, B.&lt;/b&gt;, S.*&lt;br/&gt;
  FROM author A&lt;br/&gt;
  LEFT JOIN (&lt;br/&gt;
    book B&lt;br/&gt;
    INNER JOIN sale S WITH S.dt &amp;gt;= &apos;2010-01-01&apos;&lt;br/&gt;
  ) WITH A.name LIKE &apos;%A%&apos;&lt;/p&gt;

&lt;p&gt;If the database would contain thousands of books, but sales for just a&lt;br/&gt;
few books, this will definitely perform better than using subselects.&lt;br/&gt;
Off course one would like to fetch array graphs instead of objects for&lt;br/&gt;
further optimization, but this hopefully shows my point.&lt;/p&gt;

&lt;p&gt;I have attached a test casefor a similar query, though without the additional&lt;br/&gt;
join constraints for clarity. I surely hope you can consider it.&lt;/p&gt;

&lt;p&gt;One last note, you shouldn&apos;t be afraid that nesting joins is not in the&lt;br/&gt;
ansi SQL spec. Select queries are about record sets and products&lt;br/&gt;
between these sets, tables are just the basic means of providing record&lt;br/&gt;
sets to the query. This is an important terminological difference to think about.&lt;br/&gt;
Specifying precedence with parenthesis around joins is a logical and&lt;br/&gt;
natural evolution of the ansi sql standard. For example views are a good&lt;br/&gt;
proof of this concept, I could define book B INNER JOIN sale S as a view&lt;br/&gt;
and LEFT JOIN that to authors to get effectively the same result&lt;br/&gt;
set as the above example. The database server would internally perform the&lt;br/&gt;
same query (though may additionally take indexes on the view into account).&lt;br/&gt;
That said, rdbm&apos;s that support this syntax would certainly never drop the&lt;br/&gt;
feature, as its not a feature but just plain logical and smart querying!&lt;/p&gt;

&lt;p&gt;P.S. I had a hard time finding out how to run the test cases, I could not find&lt;br/&gt;
it in the Doctrine 2 documentation, development wiki, cookbook or any other&lt;br/&gt;
place, while finally it was as easy as running phpunit  Doctrine_Tests_AllTests&lt;br/&gt;
from within the tests/ directory, or just phpunit  Doctrine_Tests_ORM_Functional_Ticket_DDC349Test&lt;br/&gt;
for my test. Could you please add some info about this somewhere, it might&lt;br/&gt;
save others some googling.&lt;/p&gt;</comment>
                    <comment id="12664" author="dennis.verspuij" created="Tue, 13 Apr 2010 17:50:11 +0000"  >&lt;p&gt;Test case as SVN patch using a parenthesized join.&lt;br/&gt;
Just remove the parenthesises from the query to have it fail...&lt;/p&gt;</comment>
                    <comment id="13083" author="romanb" created="Sat, 29 May 2010 06:37:17 +0000"  >&lt;p&gt;@&quot;The need for native queries partly reverts the benefits Doctrine offers in the first place.&quot;&lt;/p&gt;

&lt;p&gt;That is something I hugely disagree with. Neither SQL abstraction, nor database vendor independence is the main purpose of an ORM like Doctrine 2.&lt;br/&gt;
It is the &lt;b&gt;state management of your objects, the transparent change tracking, lazy-loading and synchronization of the object state with the database state&lt;/b&gt; and nothing of this gets lost when using native queries.&lt;/p&gt;

&lt;p&gt;We could rip out DQL and any other querying mechanism except a basic find() (and lazy-loading, of course), only providing the native query facility and even only supporting MySQL and would still retain all the core ORM functionality.&lt;/p&gt;

&lt;p&gt;NativeQuery is one of the best and core &quot;features&quot; of the project. It is even the &lt;b&gt;foundation&lt;/b&gt; for DQL. A DQL query is nothing more than an additional (beautiful) abstraction but what comes out is a native query + a ResultSetMapping, the same thing you can build yourself in the first place, &lt;b&gt;even using the mapping metadata to construct the query&lt;/b&gt;. Nothing forces you to hardcode table and column names in native queries if you don&apos;t want that. Just use the mapping metadata, DQL does the same.&lt;/p&gt;

&lt;p&gt;SQL abstraction and database vendor independence is icing on the cake, not the heart of the ORM.&lt;/p&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10000">
                <name>Duplicate</name>
                                                <inwardlinks description="is duplicated by">
                            <issuelink>
            <issuekey id="12797">DDC-1256</issuekey>
        </issuelink>
                    </inwardlinks>
                            </issuelinktype>
                    </issuelinks>
                <attachments>
                    <attachment id="10569" name="DDC349Test.patch" size="5354" author="dennis.verspuij" created="Tue, 13 Apr 2010 17:50:11 +0000" />
                </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-838] SchemaTool - ignores the attribute uniq in relations</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-838</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;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;Mapper&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;&amp;lt;entity name=&lt;span class=&quot;code-quote&quot;&gt;&quot;Default_Model_Test&quot;&lt;/span&gt; table=&lt;span class=&quot;code-quote&quot;&gt;&quot;test&quot;&lt;/span&gt;&amp;gt;
  &amp;lt;id name=&lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&lt;/span&gt; type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt; column=&lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&lt;/span&gt;&amp;gt;
    &amp;lt;generator strategy=&lt;span class=&quot;code-quote&quot;&gt;&quot;AUTO&quot;&lt;/span&gt;/&amp;gt;
  &amp;lt;/id&amp;gt;
  &amp;lt;field name=&lt;span class=&quot;code-quote&quot;&gt;&quot;blabla&quot;&lt;/span&gt; column=&lt;span class=&quot;code-quote&quot;&gt;&quot;blabla&quot;&lt;/span&gt; type=&lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-object&quot;&gt;boolean&lt;/span&gt;&quot;&lt;/span&gt;/&amp;gt;
  &amp;lt;one-to-one field=&lt;span class=&quot;code-quote&quot;&gt;&quot;user&quot;&lt;/span&gt; target-entity=&lt;span class=&quot;code-quote&quot;&gt;&quot;Users_Model_User&quot;&lt;/span&gt;&amp;gt;
    &amp;lt;join-column name=&lt;span class=&quot;code-quote&quot;&gt;&quot;users_id&quot;&lt;/span&gt; referenced-column-name=&lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&lt;/span&gt; on-delete=&lt;span class=&quot;code-quote&quot;&gt;&quot;CASCADE&quot;&lt;/span&gt; on-update=&lt;span class=&quot;code-quote&quot;&gt;&quot;CASCADE&quot;&lt;/span&gt; unique=&lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;&quot;&lt;/span&gt; /&amp;gt;
  &amp;lt;/one-to-one&amp;gt;
&amp;lt;/entity&amp;gt;
&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;SQL&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;CREATE TABLE test (id INT AUTO_INCREMENT NOT NULL, users_id INT DEFAULT NULL, blabla TINYINT(1) NOT NULL, UNIQUE INDEX test_users_id_uniq (users_id), PRIMARY KEY(id)) ENGINE = InnoDB;
ALTER TABLE test ADD FOREIGN KEY (users_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Actual:&lt;br/&gt;
UNIQUE INDEX test_users_id_uniq (users_id)&lt;/p&gt;

&lt;p&gt;Expected:&lt;br/&gt;
INDEX test_users_id (users_id)&lt;/p&gt;</description>
                <environment>Ubuntu, PHP 5.3.2, MySQL </environment>
            <key id="12005">DDC-838</key>
            <summary>SchemaTool - ignores the attribute uniq in relations</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="gektor">gektor</reporter>
                        <labels>
                    </labels>
                <created>Wed, 13 Oct 2010 12:01:46 +0000</created>
                <updated>Fri, 29 Oct 2010 09:23:04 +0000</updated>
                                    <version>2.0-BETA4</version>
                                <fixVersion>2.x</fixVersion>
                                <component>Tools</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="14564" author="beberlei" created="Thu, 14 Oct 2010 03:35:46 +0000"  >&lt;p&gt;Verified, i just don&apos;t understand why you are using a one-to-one relation and then &quot;deactivate&quot; the database constraint for this. You could easily use Many-To-One&lt;/p&gt;</comment>
                    <comment id="14566" author="gektor" created="Thu, 14 Oct 2010 08:25:18 +0000"  >&lt;p&gt;You are right. It&apos;s not a bug, it&apos;s feature.&lt;/p&gt;</comment>
                    <comment id="14612" author="beberlei" created="Fri, 29 Oct 2010 09:23:04 +0000"  >&lt;p&gt;This might still be a good improvement to allow the flexibility, but its not a bug. Updating to &quot;Minor Improvmenet for 2.x&quot;&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-900] Insufficient Error Information for orm:validate-schema</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-900</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Running &quot;doctrine orm:validate-schema&quot; would return -&amp;gt; &lt;span class=&quot;error&quot;&gt;&amp;#91;Database&amp;#93;&lt;/span&gt; FAIL - The database schema is not in sync with the current mapping file.&lt;/p&gt;

&lt;p&gt;It should have at least return the name of the table/field that is not in sync.&lt;/p&gt;</description>
                <environment>linux, php 5.3.3</environment>
            <key id="12174">DDC-900</key>
            <summary>Insufficient Error Information for orm:validate-schema</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="aurorius">aurorius</reporter>
                        <labels>
                    </labels>
                <created>Mon, 29 Nov 2010 06:37:16 +0000</created>
                <updated>Mon, 29 Nov 2010 06:37:16 +0000</updated>
                                    <version>2.0-BETA4</version>
                                                <component>Tools</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-891] DDC-117: No sequence generation with composite foreign key</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-891</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Given the following entity definitions, Doctrine does not attempt to manage generated values. For example, in MySQL, it is perfectly possible to create a composite primary key and set auto_increment on one of these. See below the code for issues that occur.&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;User.php&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;/**
 * @Entity
 */
class User {
	/**
	 * @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; $name;
	
	/**
	 * @OneToMany(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;PhoneNumber&quot;&lt;/span&gt;,mappedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&lt;/span&gt;,cascade={&lt;span class=&quot;code-quote&quot;&gt;&quot;all&quot;&lt;/span&gt;})
	 */
	&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $phoneNumbers;
	
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setName ($name) {
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;name = $name;
	}
}
&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;PhoneNumber.php&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;/**
 * @Entity
 */
class PhoneNumber {
	/**
	 * @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;
	
	/**
	 * @Id
	 * @ManyToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;User&quot;&lt;/span&gt;,cascade={&lt;span class=&quot;code-quote&quot;&gt;&quot;all&quot;&lt;/span&gt;})
	 */
	&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $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; $phonenumber;
	
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setUser (User $user) {
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;user = $user;
	}
	
	&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setPhoneNumber ($phoneNumber) {
		$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;phonenumber = $phoneNumber;
	}
}
&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;Invokation&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$albert = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; User;
$albert-&amp;gt;setName(&lt;span class=&quot;code-quote&quot;&gt;&quot;albert&quot;&lt;/span&gt;);
$em-&amp;gt;persist($albert);

$phoneAlbert1 = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; PhoneNumber();
$phoneAlbert1-&amp;gt;setUser($albert);
$phoneAlbert1-&amp;gt;setPhoneNumber(&lt;span class=&quot;code-quote&quot;&gt;&quot;albert home: 012345&quot;&lt;/span&gt;);
$em-&amp;gt;persist($phoneAlbert1);

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

&lt;p&gt;The first issue which occurs is that Doctrine does not generate the field &quot;id&quot; within PhoneNumber set to auto_increment.&lt;/p&gt;

&lt;p&gt;The second issue which occurs is that Doctrine becomes confused when inserting a new record into PhoneNumber, because of the following INSERT INTO statement:&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;Insert Statement&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;INSERT INTO PhoneNumber (user_id, phonenumber) VALUES (?, ?)
array(1) {
  [1]=&amp;gt;
  string(19) &lt;span class=&quot;code-quote&quot;&gt;&quot;albert home: 012345&quot;&lt;/span&gt;
}

SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="12158">DDC-891</key>
            <summary>DDC-117: No sequence generation with composite foreign key</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="felicitus">Timo A. Hummel</reporter>
                        <labels>
                    </labels>
                <created>Thu, 25 Nov 2010 00:40:24 +0000</created>
                <updated>Thu, 25 Nov 2010 06:05:05 +0000</updated>
                                                                            <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="14830" author="romanb" created="Thu, 25 Nov 2010 02:28:52 +0000"  >&lt;p&gt;I don&apos;t think this will ever be possible.&lt;/p&gt;</comment>
                    <comment id="14831" author="felicitus" created="Thu, 25 Nov 2010 02:32:39 +0000"  >&lt;p&gt;Is there a technical reason for that? I mean, with &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; we are aiming for composite foreign keys, or is &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; cancelled?&lt;/p&gt;</comment>
                    <comment id="14835" author="beberlei" created="Thu, 25 Nov 2010 04:55:19 +0000"  >&lt;p&gt;A composite key is ALWAYS of the type &quot;ASSIGNED&quot; and cannot be a combination of different id generation strategies.&lt;/p&gt;

&lt;p&gt;You could however write a prePersist Listener that does this for you.&lt;/p&gt;</comment>
                    <comment id="14836" author="felicitus" created="Thu, 25 Nov 2010 06:05:05 +0000"  >&lt;p&gt;Okay, maybe this is a feature for 3.0 or so. However, I&apos;d suggest leaving this bug open as this is something which needs to be documented once &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; becomes integrated within the main branch.&lt;/p&gt;

&lt;p&gt;Additionally, Doctrine should complain about different ID generation strategies. Right now it silently ignores it.&lt;/p&gt;</comment>
                </comments>
                    <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-445] Evaluate possible ways in which stored procedures can be used</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-445</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;We should evaluate the current situation of stored procedure support as well as where we want to go with it / how far we want to support it, if at all.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11094">DDC-445</key>
            <summary>Evaluate possible ways in which stored procedures can be used</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>Fri, 19 Mar 2010 12:27:42 +0000</created>
                <updated>Fri, 24 Dec 2010 04:49:52 +0000</updated>
                                                    <fixVersion>2.x</fixVersion>
                                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="12373" author="beberlei" created="Fri, 19 Mar 2010 12:48:10 +0000"  >&lt;p&gt;I think this relates to the usage of Custom Persisters&lt;/p&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10001">
                <name>Reference</name>
                                <outwardlinks description="relates to">
                            <issuelink>
            <issuekey id="10999">DDC-391</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-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-677] Allow DQL DELETE statements to work with join table fk constraints</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-677</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Currently DQL DELETE will break if any foreign key constraint restricts the delete. &lt;/p&gt;

&lt;p&gt;Using the Metadata we can possibly detect these join table FK contstraints and delete them correctly.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11605">DDC-677</key>
            <summary>Allow DQL DELETE statements to work with join table fk constraints</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="beberlei">Benjamin Eberlei</reporter>
                        <labels>
                    </labels>
                <created>Sat, 10 Jul 2010 05:28:00 +0000</created>
                <updated>Sat, 10 Jul 2010 08:11:06 +0000</updated>
                                    <version>2.0-BETA2</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                            <issuelinks>
                        <issuelinktype id="10001">
                <name>Reference</name>
                                                <inwardlinks description="is referenced by">
                            <issuelink>
            <issuekey id="10368">DDC-130</issuekey>
        </issuelink>
                    </inwardlinks>
                            </issuelinktype>
                    </issuelinks>
                <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-747] Add support for table, column and indexes comments</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-747</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;It would be nice to add support for table comments, column comments and indexes comments, 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;@Table(
    name=&lt;span class=&quot;code-quote&quot;&gt;&quot;ecommerce_products&quot;&lt;/span&gt;,
    comment=&lt;span class=&quot;code-quote&quot;&gt;&quot;Contains products&quot;&lt;/span&gt;,
    indexes={@index(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;search_idx&quot;&lt;/span&gt;, comment=&lt;span class=&quot;code-quote&quot;&gt;&quot;Makes finding people by name easier&quot;&lt;/span&gt;, columns={&lt;span class=&quot;code-quote&quot;&gt;&quot;name&quot;&lt;/span&gt;, &lt;span class=&quot;code-quote&quot;&gt;&quot;email&quot;&lt;/span&gt;})}
)

@Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;, comment=&lt;span class=&quot;code-quote&quot;&gt;&quot;Stores the user&apos;s age, in years&quot;&lt;/span&gt;)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;



&lt;p&gt;MySQL supports comments via &lt;a href=&quot;http://dev.mysql.com/doc/refman/4.1/en/create-table.html&quot; class=&quot;external-link&quot;&gt;ALTER TABLE&lt;/a&gt; since 4.1.&lt;br/&gt;
PostgreSQL support comments via &lt;a href=&quot;http://www.postgresql.org/docs/7.4/static/sql-comment.html&quot; class=&quot;external-link&quot;&gt;COMMENT&lt;/a&gt; at least since 7.4.&lt;br/&gt;
SQLite &lt;a href=&quot;http://www.sqlite.org/cvstrac/wiki?p=UnsupportedSql&quot; class=&quot;external-link&quot;&gt;doesn&apos;t appear to support table, column or indexes comments&lt;/a&gt; as of 3.7.&lt;br/&gt;
Oracle supports comments on tables and columns via &lt;a href=&quot;http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_4009.htm#SQLRF01109&quot; class=&quot;external-link&quot;&gt;COMMENT&lt;/a&gt; at least since 10.1. It doesn&apos;t appear to support comments on indexes.&lt;/p&gt;

&lt;p&gt;For databases that don&apos;t support those persistent comments, you could use normal SQL comments in the table definition. Of course they wouldn&apos;t be stored by the database, but at least they would appear in the generated schema, that&apos;s better than nothing.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11771">DDC-747</key>
            <summary>Add support for table, column and indexes comments</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="s9e">s9e</reporter>
                        <labels>
                    </labels>
                <created>Fri, 13 Aug 2010 23:17:17 +0000</created>
                <updated>Sat, 14 Aug 2010 06:32:08 +0000</updated>
                                                                    <component>Mapping Drivers</component>
                        <due></due>
                    <votes>4</votes>
                        <watches>4</watches>
                                <attachments>
                </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-823] Errors  in 2.0 Cookbook Documentation</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-823</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/projects/orm/2.0/docs/cookbook/getting-started-xml-edition/en#getting-started-xml-edition&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/projects/orm/2.0/docs/cookbook/getting-started-xml-edition/en#getting-started-xml-edition&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Paragraph 1:&lt;br/&gt;
The benefit of Doctrine for the programmer is the possibility &lt;del&gt;can&lt;/del&gt; &lt;ins&gt;to&lt;/ins&gt; focus &lt;del&gt;soley&lt;/del&gt; &lt;ins&gt;solely&lt;/ins&gt; on the business and worry about persistence only as a secondary task. This doesn&apos;t mean persistence is not important to Doctrine 2, however it is our belief that there are considerable benefits for object-oriented programming, if persistence and entities are kept perfectly &lt;del&gt;seperated&lt;/del&gt; &lt;ins&gt;separated&lt;/ins&gt;.&lt;/p&gt;

&lt;p&gt;Paragraph 2:&lt;br/&gt;
Entities are &lt;del&gt;leightweight&lt;/del&gt; &lt;ins&gt;lightweight&lt;/ins&gt; PHP Objects that don&apos;t need to extend any abstract base class or interface. An entity class must not be final or contain final methods. Additionally it must not implement __clone nor __wakeup or &lt;ins&gt;it should&lt;/ins&gt; do so safely.&lt;/p&gt;


&lt;p&gt;What would be the best way to note other errors?&lt;/p&gt;</description>
                <environment></environment>
            <key id="11972">DDC-823</key>
            <summary>Errors  in 2.0 Cookbook Documentation</summary>
                <type id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/task.png">Task</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="ralfas">Ralfas Jegorovas</reporter>
                        <labels>
                    </labels>
                <created>Fri, 1 Oct 2010 20:34:03 +0000</created>
                <updated>Mon, 11 Jul 2011 17:38:41 +0000</updated>
                                                                    <component>Documentation</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="14521" author="beberlei" created="Mon, 4 Oct 2010 05:20:50 +0000"  >&lt;p&gt;The best way for us would be if you fork the docs on github, change the stuff and commit it. Then issue a pull request. It sounds complicated, but should be minimal overhead of ~5 minutesn on your end, but then we can merge it with a mouse-click, so we dont need to duplicate the whole correction effort on our end.&lt;/p&gt;</comment>
                    <comment id="15192" author="jclermont" created="Thu, 27 Jan 2011 08:11:40 +0000"  >&lt;p&gt;I have fixed the typos from this ticket that were still present in the docs and issued a pull request on Github.&lt;/p&gt;</comment>
                    <comment id="16147" author="mridgway" created="Mon, 11 Jul 2011 17:38:41 +0000"  >&lt;p&gt;This issue should be closed: &lt;a href=&quot;https://github.com/doctrine/orm-documentation/pull/17&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/orm-documentation/pull/17&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-940] Entities can / can not have private properties</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-940</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;In the note in&lt;br/&gt;
&lt;a href=&quot;http://www.doctrine-project.org/docs/orm/2.0/en/reference/working-with-objects.html#merging-entities&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/docs/orm/2.0/en/reference/working-with-objects.html#merging-entities&lt;/a&gt;&lt;br/&gt;
It appears to state that private variables are not serialized for child objects&lt;/p&gt;

&lt;p&gt;If this is the only reason entities can&apos;t have private properties, then this restriction is no longer valid, or possibly be reconsidered.&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;?php

class A {
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $a = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;;

    &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;a = $value;
    }
}

class B &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; A {}

$b = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; B();
$b-&amp;gt;setValue(&lt;span class=&quot;code-quote&quot;&gt;&quot;B&quot;&lt;/span&gt;);
var_dump($b);

$c = unserialize(serialize($b));
var_dump($c);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The output suggests private variables are serialized, and are restored fine&lt;/p&gt;</description>
                <environment>PHP 5.3.3 (cli) (built: Nov 14 2010 16:54:26)</environment>
            <key id="12236">DDC-940</key>
            <summary>Entities can / can not have private properties</summary>
                <type id="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/documentation.png">Documentation</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="tech13">Ray Rehbein</reporter>
                        <labels>
                    </labels>
                <created>Wed, 15 Dec 2010 13:53:15 +0000</created>
                <updated>Wed, 15 Dec 2010 13:53:15 +0000</updated>
                                    <version>2.0-RC2</version>
                                                <component>Documentation</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <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>