<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Wed May 22 01:10: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-1895/DDC-1895.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-1895] update an entity with an ID column which is a relation instead of a normal field</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1895</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I got this error when trying to update an entity with an ID column which is a relation instead of a normal field: &lt;a href=&quot;https://gist.github.com/3399c0ad5e0a44a29f98&quot; class=&quot;external-link&quot;&gt;https://gist.github.com/3399c0ad5e0a44a29f98&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is the relevant mapping:&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

namespace Roompot\TRSBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Samson\Bundle\TRSBundle\Entity\Registrar;

/**
 * @ORM\Entity
 */
class RegistrarDepartmentMapping
{
    /**
     * @ORM\ManyToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;RoompotRegistrar&quot;&lt;/span&gt;)
     * @ORM\JoinColumn(referencedColumnName=&lt;span class=&quot;code-quote&quot;&gt;&quot;person_id&quot;&lt;/span&gt;)
     * @ORM\Id
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $registrar;

    /**
     * @ORM\ManyToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;Department&quot;&lt;/span&gt;)
     * @ORM\Id
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $department;

    /**
     * @ORM\Column(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;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $head = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;

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

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setRegistrar(Registrar $registrar)
    {
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (&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;registrar) {
            &lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; \RuntimeException(&apos;Cannot change registrar! Remove &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; entity and create a &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; one&apos;);
        }
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;registrar = $registrar;
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function getDepartment()
    {
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (&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;registrar) {
            &lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; \RuntimeException(&apos;Cannot change department! Remove &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; entity and create a &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; one&apos;);
        }
        &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;department;
    }

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setDepartment(Department $department)
    {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;department = $department;
    }

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

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function setHead($head)
    {
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;head = $head;
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;&amp;lt;?php

namespace Roompot\TRSBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Samson\Bundle\TRSBundle\Entity\Registrar;

/**
 * @ORM\Entity
 */
class RoompotRegistrar &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; Registrar
{
    [...]
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;&amp;lt;?php

namespace Samson\Bundle\TRSBundle\Entity;

use Samson\Bundle\AddressBookBundle\Entity\Person;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity 
 * @ORM\InheritanceType(&lt;span class=&quot;code-quote&quot;&gt;&quot;SINGLE_TABLE&quot;&lt;/span&gt;)
 * @ORM\DiscriminatorColumn(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;discr&quot;&lt;/span&gt;, type=&lt;span class=&quot;code-quote&quot;&gt;&quot;string&quot;&lt;/span&gt;)
 */
&lt;span class=&quot;code-keyword&quot;&gt;abstract&lt;/span&gt; class Registrar
{
    /**
     * @ORM\Id
     * @ORM\OneToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;Samson\Bundle\AddressBookBundle\Entity\Person&quot;&lt;/span&gt;, cascade={&lt;span class=&quot;code-quote&quot;&gt;&quot;persist&quot;&lt;/span&gt;})
     * @ORM\JoinColumn(nullable=&lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, onDelete=&lt;span class=&quot;code-quote&quot;&gt;&quot;CASCADE&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $person;

    [...]
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;&amp;lt;?php

namespace Samson\Bundle\AddressBookBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity(repositoryClass=&lt;span class=&quot;code-quote&quot;&gt;&quot;Samson\Bundle\AddressBookBundle\Entity\PersonRepository&quot;&lt;/span&gt;)
 */
class Person &lt;span class=&quot;code-keyword&quot;&gt;implements&lt;/span&gt; [...]
{
    /**
     * @ORM\Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;)
     * @ORM\Id
     * @ORM\GeneratedValue
     */
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; $id;

    [...]
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I was able to fix the error by updating BasicEntityPersister: &lt;a href=&quot;https://github.com/SamsonIT/doctrine2/compare/fetching_id_column_if_relation&quot; class=&quot;external-link&quot;&gt;https://github.com/SamsonIT/doctrine2/compare/fetching_id_column_if_relation&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
            <key id="13804">DDC-1895</key>
            <summary>update an entity with an ID column which is a relation instead of a normal field</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="1">Fixed</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="burgov">Bart van den Burg</reporter>
                        <labels>
                    </labels>
                <created>Wed, 27 Jun 2012 10:12:19 +0000</created>
                <updated>Thu, 5 Jul 2012 20:00:50 +0000</updated>
                    <resolved>Thu, 5 Jul 2012 20:00:50 +0000</resolved>
                            <version>Git Master</version>
                                <fixVersion>2.2.3</fixVersion>
                <fixVersion>2.3</fixVersion>
                                <component>Mapping Drivers</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="18200" author="beberlei" created="Thu, 5 Jul 2012 20:00:50 +0000"  >&lt;p&gt;Fixed&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>