<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Sun May 26 05:11:57 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-2033/DDC-2033.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-2033] Merge with multiple Associations to the same Entity</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2033</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;Let&apos;s say we have 2 Entities. User and Group and there&apos;s a ManyToMany Assocication and an additional ManyToOne (User as owning side and no inverse).&lt;/p&gt;

&lt;p&gt;So a User can have as many Groups as he likes and one another with the ManyToOne Association which can be also in the ManyToMany Collection. (Could be the MainGroup or something)&lt;/p&gt;

&lt;p&gt;I create a User and add a Group(already in DB) and set the same as the ManyToOne and Merge it. Everything works fine as long as the Group in ManyToOne Association is not in the ManyToMany. &lt;/p&gt;

&lt;p&gt;If I var_dump the merged entity i can already see that one association is empty.&lt;/p&gt;

&lt;p&gt;It looks like doctrine is writing just one association of that Group preferring which one comes first. So if i change the position of the properties in the class the written association changes, but doctrine never writes both.&lt;/p&gt;

&lt;p&gt;The reason why I use merge is that I normally store the entity in the session and merge and flush it in another request. But this also happens in the same Request.&lt;/p&gt;

&lt;p&gt;In the UnitofWork at Line 2050 and 2053 are the responsible doMerge Calls for as CascadeMerge Tagged Associations. If Doctrine gets there in the first place the doMerge for the Group is running through. In the Second call when the Group is again associated with the user the doMerge already exits at line 1658. That&apos;s ok but I think there&apos;s something missing so doctrine isn&apos;t creating the association.&lt;/p&gt;

&lt;p&gt;The Mentioned Entites are attached&lt;/p&gt;</description>
                <environment>Symfony 2.1.1, Ubuntu, PHP 5.3.5</environment>
            <key id="14044">DDC-2033</key>
            <summary>Merge with multiple Associations to the same 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="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/closed.png">Closed</status>
                    <resolution id="3">Duplicate</resolution>
                    <security id="10000">All</security>
                        <assignee username="ocramius">Marco Pivetta</assignee>
                                <reporter username="soeren.j">s&#246;ren jahns</reporter>
                        <labels>
                        <label>merge</label>
                    </labels>
                <created>Mon, 17 Sep 2012 14:29:20 +0000</created>
                <updated>Wed, 23 Jan 2013 22:06:58 +0000</updated>
                    <resolved>Wed, 23 Jan 2013 22:06:58 +0000</resolved>
                            <version>2.2.3</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="19380" author="ocramius" created="Wed, 23 Jan 2013 22:06:58 +0000"  >&lt;p&gt;Duplicate of &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-1942&quot; title=&quot;problem with serialize/merging entities with aggregation&quot;&gt;&lt;del&gt;DDC-1942&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11323" name="Group.php" size="485" author="soeren.j" created="Mon, 17 Sep 2012 14:29:20 +0000" />
                    <attachment id="11324" name="User.php" size="951" author="soeren.j" created="Mon, 17 Sep 2012 14:29:20 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>