<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Wed Jun 19 15:50:52 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-1269/DDC-1269.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-1269] Unexpected behavior while using association on a non primary key field</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1269</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;We have association on non primary key. Something 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;Entities\Payment:
  type: entity
  table: payments
  fields:
    id: 
      id: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      type: integer
      nullable: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      generator:
        strategy: IDENTITY
[-- skipped --]
  manyToOne:
    order:
      targetEntity: Entities\Order
      inversedBy: payments
      joinColumn:
        name: scode
        referencedColumnName: scode
&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;Entities\Order:
  type: entity
  table: h_orders
  fields:
    id:
      id: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
      type: integer
      unsigned: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      nullable: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      generator:
        strategy: IDENTITY
    scode:
      type: integer
      unsigned: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
      nullable: &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
[-- skipped --]
  oneToMany:
    payments:
      targetEntity: Entities\Payment
      mappedBy: order
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;When I try to fetch Order from Payment with lazy loading I receive empty Order object with null properties. If I use eager fetching Order object is valid.&lt;br/&gt;
SQL generated for lazy loading seems to be valid, so I suppose the problem is in mapping result to the object. At the same time lazy loading works fine with 2.0.6 version.&lt;/p&gt;




&lt;p&gt;Another problem appears while persisting new Payment. &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;$payment = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; \Entities\Payment();
...
$order = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;em-&amp;gt;getRepository(&apos;\Entities\Order&apos;)-&amp;gt;find(46320);
$payment-&amp;gt;setOrder($order);
$order-&amp;gt;addPayments($payment);
$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;em-&amp;gt;persist($payment);
$&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;I get this error: Fatal error: Uncaught exception &apos;PDOException&apos; with message &apos;SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;23000&amp;#93;&lt;/span&gt;: Integrity constraint violation: 1048 Column &apos;scode&apos; cannot be null&apos; in /usr/share/php/Doctrine/DBAL/Statement.php:131&lt;/p&gt;

&lt;p&gt;I found issue which is still open and looks like mine &amp;#8211; &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DDC-1114&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DDC-1114&lt;/a&gt;. What do you think about this? &lt;/p&gt;</description>
                <environment></environment>
            <key id="12813">DDC-1269</key>
            <summary>Unexpected behavior while using association on a non primary key field</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="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="saniok">Alexandr Torchenko</reporter>
                        <labels>
                    </labels>
                <created>Mon, 11 Jul 2011 13:03:18 +0000</created>
                <updated>Wed, 13 Jul 2011 13:26:20 +0000</updated>
                                    <version>2.1</version>
                                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="16153" author="beberlei" created="Tue, 12 Jul 2011 20:26:04 +0000"  >&lt;p&gt;Formatting, please add a second ticket for the second issue.&lt;/p&gt;</comment>
                    <comment id="16154" author="beberlei" created="Tue, 12 Jul 2011 20:40:11 +0000"  >&lt;p&gt;I don&apos;t think its supported to use a non primary id for foreign key matching. I cant tell for sure though since i wasnt responsible to design this part of the Doctrine code. I would strongly suggest not to do this.&lt;/p&gt;</comment>
                    <comment id="16156" author="beberlei" created="Tue, 12 Jul 2011 20:42:09 +0000"  >&lt;p&gt;Marked as improvement. The problem is we cannot detect this invalid mapping, so no exception is thrown during compilation of the mappings,&lt;/p&gt;</comment>
                    <comment id="16157" author="beberlei" created="Tue, 12 Jul 2011 20:45:23 +0000"  >&lt;p&gt;This kind of mapping error is already acknowledged by the schema-validator console task.&lt;/p&gt;</comment>
                    <comment id="16169" author="saniok" created="Wed, 13 Jul 2011 13:20:02 +0000"  >&lt;p&gt;Should I create second ticket?&lt;/p&gt;

&lt;p&gt;Please confirm that I understood correctly. Should we avoid such mapping as it is considered as invalid.&lt;/p&gt;</comment>
                    <comment id="16170" author="beberlei" created="Wed, 13 Jul 2011 13:26:20 +0000"  >&lt;p&gt;Yes, it will not work at all. You dont need to create the second ticket as that error steams from the mapping error.&lt;/p&gt;

&lt;p&gt;You will see an error message when calling ./doctrine orm:schema:validate with this mapping.&lt;/p&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10001">
                <name>Reference</name>
                                                <inwardlinks description="is referenced by">
                            <issuelink>
            <issuekey id="12563">DDC-1114</issuekey>
        </issuelink>
                    </inwardlinks>
                            </issuelinktype>
                    </issuelinks>
                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>