<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Tue Jun 18 05:25: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-2051/DDC-2051.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-2051] after filtering an association by using -&gt;matching(Criteria) original association changes</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-2051</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;after filtering an association with a criteria it changes so it&apos;s not a normal collection and you can&apos;t re-filter it.&lt;/p&gt;

&lt;p&gt;even after hydrating it you can&apos;t filter it.&lt;/p&gt;</description>
                <environment></environment>
            <key id="14084">DDC-2051</key>
            <summary>after filtering an association by using -&gt;matching(Criteria) original association changes</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="iamkoby">Koby Soto</reporter>
                        <labels>
                    </labels>
                <created>Tue, 2 Oct 2012 10:19:04 +0000</created>
                <updated>Mon, 15 Oct 2012 16:10:57 +0000</updated>
                    <resolved>Mon, 15 Oct 2012 16:10:57 +0000</resolved>
                            <version>2.3</version>
                                <fixVersion>2.4</fixVersion>
                                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="18751" author="iamkoby" created="Tue, 2 Oct 2012 10:27:41 +0000"  >&lt;p&gt;The filtering only works once and only if the database hasn&apos;t been queried! &lt;/p&gt;

&lt;p&gt;This is a major bug because i would like to filter big collections more than once per request.&lt;/p&gt;</comment>
                    <comment id="18793" author="beberlei" created="Sat, 6 Oct 2012 09:30:32 +0000"  >&lt;p&gt;Can you add a code example? I don&apos;t understand what you mean.&lt;/p&gt;</comment>
                    <comment id="18801" author="iamkoby" created="Sun, 7 Oct 2012 08:34:24 +0000"  >&lt;p&gt;sure: here&apos;s just an example (written right now to demonstrate, not taken from real project, so no criticize pls):&lt;/p&gt;

&lt;p&gt;Let&apos;s say we have two functions:&lt;/p&gt;

&lt;p&gt;1. function getExpensiveBooks($limit)&lt;/p&gt;
{
    $books = $this-&amp;gt;getBooks(); //proxy, haven&apos;t queried yet.
    $criteria = Criteria::create()-&amp;gt;where(Criteria::expr()-&amp;gt;gt(&apos;price&apos;, &apos;10&apos;))-&amp;gt;setMaxResults($limit);
    return $books-&amp;gt;matching($criteria);
   }

&lt;p&gt;2. function getCheapBooks($limit)&lt;/p&gt;
{
    $books = $this-&amp;gt;getBooks(); //proxy, haven&apos;t queried yet.
    $criteria = Criteria::create()-&amp;gt;where(Criteria::expr()-&amp;gt;lt(&apos;price&apos;, &apos;4&apos;))-&amp;gt;setMaxResults($limit);
    return $books-&amp;gt;matching($criteria);
   }

&lt;p&gt;now, let&apos;s say that in the controller i&apos;ve called:&lt;br/&gt;
$expensiveBooks = $author-&amp;gt;getExpensiveBooks(3); //will work fine, and the query will be according the criteria.&lt;br/&gt;
//but going on and doing this:&lt;br/&gt;
$cheapBooks = $author-&amp;gt;getCheapBooks(3); //will not work: matching is undefined function.&lt;/p&gt;

&lt;p&gt;It appears that doing matching only works on the first time on a certain association. &lt;/p&gt;</comment>
                    <comment id="18839" author="iamkoby" created="Mon, 15 Oct 2012 16:10:57 +0000"  >&lt;p&gt;this was due to inconsistent association type in both owner and target (target had one-to-one while owner had one-to-many)&lt;/p&gt;

&lt;p&gt;sorry&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>