<!--
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Wed May 22 21:03:54 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=labels+%3D+commitorder&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=labels+%3D+commitorder</link>
        <description>An XML representation of a search request</description>
                <language>en-us</language>
                        <issue start="0" end="2" total="2"/>
                <build-info>
            <version>5.2.7</version>
            <build-number>850</build-number>
            <build-date>21-02-2013</build-date>
        </build-info>
<item>
            <title>[DDC-1974] @OneToOne and @InheritanceType cause Duplicate Key Errors when changing the entity</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1974</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-xml&quot;&gt;
&amp;lt;?php

/** @Entity */
class A
{
    /**
     * @Id @Column(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;)
     */
    private $id;

    /**
     * @OneToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;B&quot;&lt;/span&gt;, mappedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;a&quot;&lt;/span&gt;)
     */
    private $b;
}

/** 
 * @Entity 
 * @InheritanceType(&lt;span class=&quot;code-quote&quot;&gt;&quot;SINGLE_TABLE&quot;&lt;/span&gt;)
 */
class B
{
    /**
     * @Id @Column(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;, nullable=false)
     */
    private $id;

    /**
     * @OneToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;A&quot;&lt;/span&gt;, inversedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;b&quot;&lt;/span&gt;)
     */
    private $a;
}

/** 
 * @Entity 
 */
class B_sub extends B
{
    /** @Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;string&quot;&lt;/span&gt;) */
    private $sub;
}

/** 
 * @Entity 
 */
class B_sub2 extends B
{
    /** @Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;string&quot;&lt;/span&gt;) */
    private $sub2;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;The code creates several tables and a UNIQUE KEY constraint on B (a_id)&lt;/p&gt;

&lt;p&gt;Now trying to accomplish the following sequence of action:&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-xml&quot;&gt;
$B = new B_sub();
$A = new A();

$A-&amp;gt;set(&apos;b&apos;, $B);
$B-&amp;gt;set(&apos;a&apos;, $A);

$em-&amp;gt;persist($A);
$em-&amp;gt;persist($B);
//works fine and creates the correct DB entries
$em-&amp;gt;flush();

$B_new = new B_sub2();
$B_old = $A-&amp;gt;get(&apos;b&apos;);
$A-&amp;gt;set(&apos;b&apos;, $B_new);
$B_new-&amp;gt;set(&apos;a&apos;, $A);

$em-&amp;gt;remove($B_old);
$em-&amp;gt;persist($A);
$em-&amp;gt;persist($B_new);
//does not work, because B_new is inserted first and fails the UNIQUE KEY constraint (both B_new and B_old refer to A)
$em-&amp;gt;flush();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;The result is a &quot;Duplicate entry &apos;1&apos; for key &apos;UNIQ_7F6BFCEBE26CCE03&apos;&quot;&lt;/p&gt;</description>
                <environment>Win 7, PHP 5.3, MySQL InnoDB</environment>
            <key id="13951">DDC-1974</key>
            <summary>@OneToOne and @InheritanceType cause Duplicate Key Errors when changing the entity</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/resolved.png">Resolved</status>
                    <resolution id="2">Won&apos;t Fix</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="pdobrigkeit">Philipp Dobrigkeit</reporter>
                        <labels>
                        <label>commitorder</label>
                    </labels>
                <created>Thu, 9 Aug 2012 13:01:40 +0000</created>
                <updated>Wed, 29 Aug 2012 13:23:34 +0000</updated>
                    <resolved>Wed, 29 Aug 2012 13:23:34 +0000</resolved>
                            <version>2.2.2</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="18481" author="pdobrigkeit" created="Fri, 10 Aug 2012 07:57:24 +0000"  >&lt;p&gt;Current workaround is to change the ownership of the 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-xml&quot;&gt;
&amp;lt;?php

/** @Entity */
class A
{
    /**
     * @Id @Column(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;)
     */
    private $id;

    /**
     * @OneToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;B&quot;&lt;/span&gt;, inversedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;a&quot;&lt;/span&gt;)
     */
    private $b;
}

/** 
 * @Entity 
 * @InheritanceType(&lt;span class=&quot;code-quote&quot;&gt;&quot;SINGLE_TABLE&quot;&lt;/span&gt;)
 */
class B
{
    /**
     * @Id @Column(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;, nullable=false)
     */
    private $id;

    /**
     * @OneToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;A&quot;&lt;/span&gt;, mappedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;b&quot;&lt;/span&gt;)
     */
    private $a;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="18578" author="beberlei" created="Wed, 29 Aug 2012 13:23:34 +0000"  >&lt;p&gt;Insert before Removal is by design, see discussion here &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-601&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DDC-601&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DDC-1968] CommitOrderCalculator fails to calculate right order for mixing one-to-many and one-to-one relations</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1968</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I have 2 classes. Zone and Rotator.&lt;br/&gt;
Zone relates to Rotator as One-to-Many. And Zone COULD realte to Rotator as One-to-One. Here is code snippet:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt; 
class Zone
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name=&quot;id&quot;, type=&quot;integer&quot;)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy=&quot;AUTO&quot;)
     */
    private $id;

    /**
     * @ORM\OneToMany(targetEntity=&quot;Rotator&quot;, mappedBy=&quot;zone&quot;, cascade={&quot;persist&quot;, &quot;remove&quot;, &quot;merge&quot;}, orphanRemoval=true)
     * @ORM\OrderBy({&quot;id&quot; = &quot;ASC&quot;})
     */
    private $rotators = array();

    /**
     * @var Rotator $mainRotator
     *
     * @ORM\OneToOne(targetEntity=&quot;Rotator&quot;)
     * @ORM\JoinColumn(name=&quot;mainRotatorId&quot;, referencedColumnName=&quot;id&quot;)
     */
    private $mainRotator;

    /**
     * @var int $mainRotatorId
     *
     * @ORM\Column(name=&quot;mainRotatorId&quot;, type=&quot;integer&quot;, nullable=&quot;true&quot;)
     */
    private $mainRotatorId;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt; 
class Rotator
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name=&quot;id&quot;, type=&quot;integer&quot;)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy=&quot;AUTO&quot;)
     */
    private $id;

    /**
     * @var Zone $zone
     *
     * @ORM\ManyToOne(targetEntity=&quot;Zone&quot;)
     * @ORM\JoinColumn(name=&quot;zoneId&quot;, referencedColumnName=&quot;id&quot;)
     */
    private $zone;

    /**
     * @var int $zoneId
     *
     * @ORM\Column(name=&quot;zoneId&quot;, type=&quot;integer&quot;)
     */
    private $zoneId;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;When I delete only Zone - calculator works fine. But it fails if I delete entity Site, that relates to Zone as one-to-many (and have a lot of other raltions, so I don&apos;t write it here). &lt;/p&gt;

&lt;p&gt;As I look through the code, I see CommitOrderCalculator doesn&apos;t distiguish mandatory many-to-one relation from optional one-to-one one.&lt;/p&gt;

&lt;p&gt;PS this code hadn&apos;t been changed since 2.0, so this bug should be reproducable for master.&lt;/p&gt;</description>
                <environment></environment>
            <key id="13911">DDC-1968</key>
            <summary>CommitOrderCalculator fails to calculate right order for mixing one-to-many and one-to-one relations</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="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/resolved.png">Resolved</status>
                    <resolution id="6">Invalid</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="miptpatriot">miptpatriot</reporter>
                        <labels>
                        <label>commitorder</label>
                    </labels>
                <created>Sun, 5 Aug 2012 10:30:55 +0000</created>
                <updated>Sun, 6 Jan 2013 18:41:36 +0000</updated>
                    <resolved>Sun, 6 Jan 2013 18:41:36 +0000</resolved>
                            <version>2.0.7</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>4</watches>
                        <comments>
                    <comment id="18522" author="guilhermeblanco" created="Fri, 17 Aug 2012 04:55:34 +0000"  >&lt;p&gt;Your issue is because you have $zone and $zoneId pointing both to an association AND to a field.&lt;br/&gt;
Remove the $zoneId field (you can grab it by many different ways) and your issue should be solved.&lt;/p&gt;</comment>
                    <comment id="18798" author="beberlei" created="Sat, 6 Oct 2012 10:04:40 +0000"  >&lt;p&gt;You mention Site? Where is this entity, please make a snippet available as well.&lt;/p&gt;

&lt;p&gt;And then, can you show some example object graph that you are trying to delete? This case is data dependent.&lt;/p&gt;</comment>
                    <comment id="18799" author="miptpatriot" created="Sat, 6 Oct 2012 10:17:54 +0000"  >&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;class Site
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name=&quot;id&quot;, type=&quot;integer&quot;)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy=&quot;AUTO&quot;)
     */
    private $id;

    /**
     * @var \Doctrine\Common\Collections\Collection|SiteAlias[]
     * @ORM\OneToMany(targetEntity=&quot;SiteAlias&quot;, mappedBy=&quot;site&quot;, cascade={&quot;persist&quot;, &quot;remove&quot;, &quot;merge&quot;}, orphanRemoval=true)
     */
    private $aliases;

    /**
     * @ORM\OneToMany(targetEntity=&quot;Zone&quot;, mappedBy=&quot;site&quot;, cascade={&quot;persist&quot;, &quot;remove&quot;, &quot;merge&quot;}, orphanRemoval=true)
     */
    private $zones;

    /**
     * @ORM\OneToMany(targetEntity=&quot;Banner&quot;, mappedBy=&quot;site&quot;, cascade={&quot;persist&quot;, &quot;remove&quot;, &quot;merge&quot;}, orphanRemoval=true)
     */
    private $banners;

    /**
     * @var integer
     *
     * @ORM\Column(name=&quot;user_id&quot;, type=&quot;integer&quot;)
     */
    private $user_id;

    /**
     * @var \Iw\UserBundle\Entity\User
     *
     * @ORM\ManyToOne(targetEntity=&quot;\Iw\UserBundle\Entity\User&quot;)
     * @ORM\JoinColumn(name=&quot;user_id&quot;, referencedColumnName=&quot;id&quot;)
     */
    private $user;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="18800" author="miptpatriot" created="Sat, 6 Oct 2012 10:20:43 +0000"  >&lt;p&gt;Is there any fast way to debug output object graph? Like execute print_r somewhere in code.&lt;/p&gt;</comment>
                    <comment id="18957" author="ivan1986" created="Thu, 8 Nov 2012 09:20:07 +0000"  >&lt;p&gt;Confirmed&lt;br/&gt;
removing ID fields not work&lt;/p&gt;

&lt;p&gt;i fix this whis add &lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;@ORM\JoinColumn(onDelete=&quot;cascade&quot;)&lt;br/&gt;
to child Entity ManyToOne link&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;OnetoOne Unidirectinal set child after of parent&lt;br/&gt;
but OneToMany set set child before of parent (how need)&lt;/p&gt;</comment>
                    <comment id="19238" author="beberlei" created="Sun, 6 Jan 2013 18:41:36 +0000"  >&lt;p&gt;I finally get this issue, and bidirecitonal foreign keys are only deletable with &quot;onDelete=CASCADE&quot;, there is absolutely no way for the CommitOrderCalculator to fix this.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>