<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Wed Jun 19 06:16:25 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-2130/DDC-2130.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-2130] A problem with obtaining Entity without cache</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2130</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I use a custom validation constraint.&lt;br/&gt;
In the constraint I want to compare old and new entity, but when I take a entity from database, I got a entity witch is equvivalent the new entity.&lt;/p&gt;

&lt;p&gt;I tried to use a query without cache&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;
$query = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getDoctrine()-&amp;gt;getRepository(&apos;SSWTestBundle:SimpleEntity&apos;)-&amp;gt;createNamedQuery(...);
...
$query-&amp;gt;useResultCache(FALSE);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This don&apos;t solved my problem.&lt;/p&gt;

&lt;p&gt;I tried to use a query without cache and with refresh&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;
$query = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getDoctrine()-&amp;gt;getRepository(&apos;SSWTestBundle:SimpleEntity&apos;)-&amp;gt;createNamedQuery(...);
...
$query-&amp;gt;useResultCache(FALSE);
$query-&amp;gt;setHint(\Doctrine\ORM\Query::HINT_REFRESH, &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This time I got a old entity from database, but the new entity was rollback to the old entity.&lt;/p&gt;

&lt;p&gt;In attach is my entity and TestCase.&lt;/p&gt;</description>
                <environment>Symfony 2.0.18</environment>
            <key id="14201">DDC-2130</key>
            <summary>A problem with obtaining Entity without cache</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="sergsw">SergSW</reporter>
                        <labels>
                    </labels>
                <created>Wed, 7 Nov 2012 07:25:17 +0000</created>
                <updated>Wed, 7 Nov 2012 13:01:11 +0000</updated>
                    <resolved>Wed, 7 Nov 2012 13:01:11 +0000</resolved>
                            <version>2.1</version>
                                                <component>ORM</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="18953" author="sergsw" created="Wed, 7 Nov 2012 07:37:36 +0000"  >&lt;p&gt;While I solved this problem so&lt;/p&gt;

&lt;p&gt;I registered mine own hint.&lt;br/&gt;
I added folow code.&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;DoctrineORMQuery&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
/**
     * SSW
     * @&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; string
     */
    &lt;span class=&quot;code-keyword&quot;&gt;const&lt;/span&gt; HINT_CREATE_NEW_INSTANCE = &apos;doctrine.create.&lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt;.instance&apos;;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;DoctrineORMUnitOfWork:line 1978&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
/* old code
&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (isset($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;identityMap[$class-&amp;gt;rootEntityName][$idHash])) {
            $entity = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;identityMap[$class-&amp;gt;rootEntityName][$idHash];
            $oid = spl_object_hash($entity);
...
*/
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (isset($&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;identityMap[$class-&amp;gt;rootEntityName][$idHash])
                &amp;amp;&amp;amp; !isset($hints[Query::HINT_CREATE_NEW_INSTANCE])) {
            $entity = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;identityMap[$class-&amp;gt;rootEntityName][$idHash];
            $oid = spl_object_hash($entity);
            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($entity &lt;span class=&quot;code-keyword&quot;&gt;instanceof&lt;/span&gt; Proxy &amp;amp;&amp;amp; ! $entity-&amp;gt;__isInitialized__) {
                $entity-&amp;gt;__isInitialized__ = &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;;
...
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I know it&apos;s wrong, because the new instanse overrided the old instance.&lt;/p&gt;</comment>
                    <comment id="18954" author="sergsw" created="Wed, 7 Nov 2012 13:01:11 +0000"  >&lt;p&gt;It&apos;s my fall.&lt;br/&gt;
I forgot deattach entity.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11346" name="SimpleEntity.php" size="1228" author="sergsw" created="Wed, 7 Nov 2012 07:25:17 +0000" />
                    <attachment id="11347" name="SimpleEntityTest.php" size="4637" author="sergsw" created="Wed, 7 Nov 2012 07:25:17 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>