<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Fri May 24 06:03:33 UTC 2013

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

<item>
            <title>[DDC-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>