<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Tue May 21 18:19:35 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://doctrine-project.org/jira/si/jira.issueviews:issue-xml/DDC-2214/DDC-2214.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Doctrine Project</title>
    <link>http://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-2214] extra single quotation in sql when using EntityRepository::findBy</title>
                <link>http://doctrine-project.org/jira/browse/DDC-2214</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;I&apos;m using symfony 2.1 with mysql.&lt;/p&gt;

&lt;p&gt;I have following code:&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;
$related = 
$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getDoctrine()-&amp;gt;getRepository(&apos;MyWebBundle:LineRelated&apos;)
-&amp;gt;findBy(array(&apos;line&apos; =&amp;gt; $lines), array(&apos;count&apos; =&amp;gt; &apos;DESC&apos;), 20);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;that generate the sql 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-sql&quot;&gt;
&lt;span class=&quot;code-keyword&quot;&gt;SELECT&lt;/span&gt; *
&lt;span class=&quot;code-keyword&quot;&gt;FROM&lt;/span&gt; line_related t0 
&lt;span class=&quot;code-keyword&quot;&gt;WHERE&lt;/span&gt; t0.line_id IN (&apos;6059&apos;, 126352, &apos;5677&apos;, &apos;6058&apos;) 
ORDER &lt;span class=&quot;code-keyword&quot;&gt;BY&lt;/span&gt; t0.count DESC 
LIMIT 20
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;please notice that the sql has extra single quotation around the number 6059,5677 and 6058. which make the sql very slow.&lt;/p&gt;

&lt;p&gt;I did a test, when using single quotation,the sql takes 300ms,when using without single quotation,the sql takes 1 ms.&lt;/p&gt;


</description>
                <environment></environment>
            <key id="14333">DDC-2214</key>
            <summary>extra single quotation in sql when using EntityRepository::findBy</summary>
                <type id="1" iconUrl="http://doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="3" iconUrl="http://doctrine-project.org/jira/images/icons/statuses/inprogress.png">In Progress</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="ocramius">Marco Pivetta</assignee>
                                <reporter username="scourgen">scourgen</reporter>
                        <labels>
                    </labels>
                <created>Wed, 26 Dec 2012 07:53:00 +0000</created>
                <updated>Mon, 1 Apr 2013 21:50:27 +0000</updated>
                                                    <fixVersion>2.4</fixVersion>
                                        <due></due>
                    <votes>0</votes>
                        <watches>4</watches>
                        <comments>
                    <comment id="19181" author="fabio.bat.silva" created="Wed, 26 Dec 2012 20:34:49 +0000"  >&lt;p&gt;Hi &lt;/p&gt;

&lt;p&gt;Could you please attach your entities or a failing test case ?&lt;/p&gt;

&lt;p&gt;Cheers&lt;/p&gt;</comment>
                    <comment id="19182" author="scourgen" created="Thu, 27 Dec 2012 04:40:42 +0000"  >&lt;p&gt;sure&lt;/p&gt;

&lt;p&gt;LineRelated.php :&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;
class LineRelated
{
    /**
     * @ORM\Id
     * @ORM\Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;)
     * @ORM\GeneratedValue(strategy=&lt;span class=&quot;code-quote&quot;&gt;&quot;AUTO&quot;&lt;/span&gt;)
     */
     &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $id;

    /**
     * @ORM\ManyToOne(targetEntity=&lt;span class=&quot;code-quote&quot;&gt;&quot;Line&quot;&lt;/span&gt;, inversedBy=&lt;span class=&quot;code-quote&quot;&gt;&quot;line_related&quot;&lt;/span&gt;)
     * @ORM\JoinColumn(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;line_id&quot;&lt;/span&gt;, referencedColumnName=&lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&lt;/span&gt;,nullable=&lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;)
     */
     &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $line;
     
    /**
     * @ORM\Column(name=&lt;span class=&quot;code-quote&quot;&gt;&quot;line_id_related&quot;&lt;/span&gt;, type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $line_related;

    /**
     * @ORM\Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;smallint&quot;&lt;/span&gt;,nullable=&lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;)
     */
     &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $count = 0;

###### get/set etc....... #######
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Line.php&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;
class Line
{
    /**
     * @ORM\Id
     * @ORM\Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;)
     * @ORM\GeneratedValue(strategy=&lt;span class=&quot;code-quote&quot;&gt;&quot;AUTO&quot;&lt;/span&gt;)
     */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $id;
########## blablabla #############

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;my action:&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;
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function right_line_relatedAction($line = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, $title=&apos;&#30456;&#20851;&#32447;&#36335;&apos;)
    {

        $lines = $l-&amp;gt;getByUser($user, array());
&lt;span class=&quot;code-comment&quot;&gt;//anyway,$lines is an array,It has several elements,each element is an instance of LineEntity.
&lt;/span&gt;
        $related = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getDoctrine()-&amp;gt;getRepository(&apos;MyWebBundle:LineRelated&apos;)-&amp;gt;findBy(array(&apos;line&apos; =&amp;gt; $lines), array(&apos;count&apos; =&amp;gt; &apos;DESC&apos;), 20);
&lt;span class=&quot;code-comment&quot;&gt;//&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; findBy function generate the sql which is slow.
&lt;/span&gt;
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $related;
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="19184" author="fabio.bat.silva" created="Thu, 27 Dec 2012 19:41:37 +0000"  >&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;How did you get this query string ?&lt;/p&gt;

&lt;p&gt;Repository#findBy does not quote the values,  It uses PDO:bindParam.&lt;br/&gt;
so the expected query string should be someting like : &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;
WHERE t0.line_id IN (?, ? ,?) 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I tried to reproduce but in my tests the generated Query binds the parameters as  &quot;PDO::PARAM_INT&quot;.&lt;/p&gt;

&lt;p&gt;I have added a test case. &lt;br/&gt;
Could you please can try to change it and make fails.&lt;/p&gt;


&lt;p&gt;Cheers&lt;/p&gt;</comment>
                    <comment id="19185" author="scourgen" created="Fri, 28 Dec 2012 06:02:41 +0000"  >&lt;p&gt;reproduced :&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;
SELECT t0.id AS id1, t0.line_id_related AS line_id_related2, t0.count AS count3, t0.line_id AS line_id4 FROM line_related t0 WHERE t0.line_id IN (&apos;6059&apos;, 4851, &apos;6068&apos;, 126352, &apos;6060&apos;, &apos;1000000&apos;) ORDER BY t0.count DESC LIMIT 20
Parameters: [[&apos;6059&apos;, 4851, &apos;6068&apos;, 126352, &apos;6060&apos;, &apos;1000000&apos;]] 
[Hide runnable query]
Time: 234.53 ms [   Explain query ]
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;let me have a look on what&apos;s going on&lt;/p&gt;</comment>
                    <comment id="19186" author="scourgen" created="Fri, 28 Dec 2012 06:10:15 +0000"  >&lt;p&gt;interesting. I&apos;ve dump(using ladybug_dump) the $lines,and I found out that when the element is a Proxies Object(Object(Proxies&amp;#95;&lt;em&gt;GC&lt;/em&gt;_\My\WebBundle\Entity\Line)),then the id of that Object will be with quoted,when the elememt is an Real Entity,then It will be without quote.&lt;/p&gt;

&lt;p&gt;for example,in my last comment, the parameters is [&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;6059&amp;#39;, 4851, &amp;#39;6068&amp;#39;, 126352, &amp;#39;6060&amp;#39;, &amp;#39;1000000&amp;#39;&amp;#93;&lt;/span&gt;] &lt;br/&gt;
the result of dumping $lines is :&lt;/p&gt;

&lt;p&gt;array(6)&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;: object(Proxies&amp;#95;&lt;em&gt;CG&lt;/em&gt;_\Zuo\WebBundle\Entity\Line)&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt;: object(Zuo\WebBundle\Entity\Line)&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;2&amp;#93;&lt;/span&gt;: object(Proxies&amp;#95;&lt;em&gt;CG&lt;/em&gt;_\Zuo\WebBundle\Entity\Line)&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;3&amp;#93;&lt;/span&gt;: object(Zuo\WebBundle\Entity\Line)&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;4&amp;#93;&lt;/span&gt;: object(Proxies&amp;#95;&lt;em&gt;CG&lt;/em&gt;_\Zuo\WebBundle\Entity\Line)&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;5&amp;#93;&lt;/span&gt;: object(Proxies&amp;#95;&lt;em&gt;CG&lt;/em&gt;_\Zuo\WebBundle\Entity\Line)&lt;/p&gt;

&lt;p&gt;tell me if you need more information. thanks&lt;/p&gt;</comment>
                    <comment id="19188" author="ocramius" created="Fri, 28 Dec 2012 09:16:41 +0000"  >&lt;p&gt;This may be because &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;$_identifier&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt; in proxies ( &lt;a href=&quot;https://github.com/doctrine/doctrine2/blob/42e83a2716d19eada4f1cd49ece77d5f5229a239/lib/Doctrine/ORM/Proxy/ProxyFactory.php#L383&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine2/blob/42e83a2716d19eada4f1cd49ece77d5f5229a239/lib/Doctrine/ORM/Proxy/ProxyFactory.php#L383&lt;/a&gt; ) is not necessarily composed by integers. This could be fixed with &lt;a href=&quot;http://doctrine-project.org/jira/browse/DCOM-96&quot; title=&quot;Extract a common ProxyFactory&quot;&gt;&lt;del&gt;DCOM-96&lt;/del&gt;&lt;/a&gt;. I&apos;ll add the tests to my development branch and will ping you back tomorrow &lt;img class=&quot;emoticon&quot; src=&quot;http://doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                    <comment id="19190" author="scourgen" created="Fri, 28 Dec 2012 11:02:46 +0000"  >&lt;p&gt;thanks&lt;/p&gt;</comment>
                    <comment id="19236" author="ocramius" created="Sun, 6 Jan 2013 14:24:42 +0000"  >&lt;p&gt;I see what is going on here... But this should not be a problem anyway, since they&apos;re bound anyway as  &quot;PDO::PARAM_INT&quot;, as &lt;a href=&quot;http://doctrine-project.org/jira/secure/ViewProfile.jspa?name=fabio.bat.silva&quot; class=&quot;user-hover&quot; rel=&quot;fabio.bat.silva&quot;&gt;Fabio B. Silva&lt;/a&gt; told you.&lt;/p&gt;

&lt;p&gt;That&apos;s only a problem with the logger showing them as string. PDO will handle the conversion before the value hits the DB as far as I know.&lt;/p&gt;</comment>
                    <comment id="19241" author="scourgen" created="Mon, 7 Jan 2013 03:48:30 +0000"  >&lt;p&gt;I can understand your point,but what I don&apos;t really get is that the execute time of sql is very long,that explained the quote should be in the sql,not like what you said,that&apos;s only a problem with the logger.&lt;/p&gt;</comment>
                    <comment id="19242" author="ocramius" created="Mon, 7 Jan 2013 06:56:16 +0000"  >&lt;p&gt;&lt;a href=&quot;http://doctrine-project.org/jira/secure/ViewProfile.jspa?name=scourgen&quot; class=&quot;user-hover&quot; rel=&quot;scourgen&quot;&gt;scourgen&lt;/a&gt; can you profile the difference directly in CLI? What about checking the bound parameter type? Are those values bound as INTs in your case?&lt;/p&gt;</comment>
                    <comment id="19244" author="scourgen" created="Mon, 7 Jan 2013 08:53:28 +0000"  >&lt;p&gt;@ocramius I wish I could, but I was using doctrine2 with symfony2,So It looks like It will takes some time to simulating all environment and settings that could allow me to reproduced the problem.&lt;/p&gt;

&lt;p&gt;but anyway,I will have a try and tell you what happen when I found something.&lt;/p&gt;</comment>
                    <comment id="19245" author="ocramius" created="Mon, 7 Jan 2013 08:58:19 +0000"  >&lt;p&gt;&lt;a href=&quot;http://doctrine-project.org/jira/secure/ViewProfile.jspa?name=scourgen&quot; class=&quot;user-hover&quot; rel=&quot;scourgen&quot;&gt;scourgen&lt;/a&gt; ok, awaiting your reply then&lt;/p&gt;</comment>
                    <comment id="19248" author="scourgen" created="Mon, 7 Jan 2013 17:48:04 +0000"  >&lt;p&gt;I&apos;ve spent some time on playing with native doctrine2. It took me awhile to setup everything. but I just don&apos;t get that how to retrive data with its Proxy ojbect(for example Proxies_CG_\My\WebBundle\Entity\Line).&lt;/p&gt;

&lt;p&gt;I mean the result of &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;$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_em-&amp;gt;getRepository(&lt;span class=&quot;code-quote&quot;&gt;&quot;something&quot;&lt;/span&gt;)-&amp;gt;findxxx()&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt; always return an array of real object. I can&apos;t reproduced the situation(#comment-19186) that happens on symfony2+doctrine2.&lt;/p&gt;

&lt;p&gt;anyway,I can make sure the problem is real exist,Because the execute time of that slow sql from the tool bar of symfony2 is same as I executed it at mysql cli. If the sql shows up on log with quote but running at mysql without quote,the execute time won&apos;t be same(actually It will be much more faster,in my case,20x times,from 2xxms to 10ms).&lt;/p&gt;
</comment>
                    <comment id="19250" author="ocramius" created="Mon, 7 Jan 2013 19:23:52 +0000"  >&lt;p&gt;&lt;a href=&quot;http://doctrine-project.org/jira/secure/ViewProfile.jspa?name=scourgen&quot; class=&quot;user-hover&quot; rel=&quot;scourgen&quot;&gt;scourgen&lt;/a&gt; you can use &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;$em-&amp;gt;getReference($className, $identifier)&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt; (identifier being a key=&amp;gt;value array) to force proxies.&lt;/p&gt;

&lt;p&gt;Give it a try &lt;img class=&quot;emoticon&quot; src=&quot;http://doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                    <comment id="19254" author="scourgen" created="Tue, 8 Jan 2013 04:27:34 +0000"  >&lt;p&gt;looks like I reproduced it.&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;
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; function testIssue()
    {   
         $no_used=   $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_em-&amp;gt;getRepository(__NAMESPACE__. &apos;\DDC2214Line&apos;)-&amp;gt;findOneById(1);
        $lines=array(
            &lt;span class=&quot;code-comment&quot;&gt;//$&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_em-&amp;gt;getRepository(__NAMESPACE__. &apos;\DDC2214Line&apos;)-&amp;gt;findOneById(1),
&lt;/span&gt;            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_em-&amp;gt;getReference(__NAMESPACE__. &apos;\DDC2214Line&apos;,1),
            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_em-&amp;gt;getReference(__NAMESPACE__. &apos;\DDC2214Line&apos;,&apos;2&apos;),
            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_em-&amp;gt;getReference(__NAMESPACE__. &apos;\DDC2214Line&apos;,3),
        );  
        $logger  = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_em-&amp;gt;getConnection()-&amp;gt;getConfiguration()-&amp;gt;getSQLLogger();
        $ids     = array_map(function($r){
            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $r-&amp;gt;id;
        }, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;relatedList);

        &lt;span class=&quot;code-comment&quot;&gt;//$related = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_em-&amp;gt;getRepository(__NAMESPACE__ . &apos;\DDC2214LineRelated&apos;)-&amp;gt;findBy(array(&apos;line&apos; =&amp;gt; $lines), array(&apos;count&apos; =&amp;gt; &apos;DESC&apos;), 20);
&lt;/span&gt;        $related = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;_em-&amp;gt;createQuery(&apos;select lr from &apos;.__NAMESPACE__ . &apos;\DDC2214LineRelated lr where lr.id in (:ids)&apos;)-&amp;gt;setParameter(&apos;ids&apos;,$lines)-&amp;gt;getResult();
            
        $query   = end($logger-&amp;gt;queries);
&lt;span class=&quot;code-comment&quot;&gt;//\Doctrine\Common\Util\Debug::dump($query[&apos;params&apos;]);
&lt;/span&gt;
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;assertCount(3, $related);
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;assertEquals($ids, $query[&apos;params&apos;][0]);
        $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;assertEquals(\Doctrine\DBAL\Connection::PARAM_INT_ARRAY, $query[&apos;types&apos;][0]);
    }   
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I use MySql Query log to see what&apos;s really happen in database(&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.5/en/query-log.html&quot; class=&quot;external-link&quot;&gt;http://dev.mysql.com/doc/refman/5.5/en/query-log.html&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;this is the log from table mysql.general_log&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;
2013-01-08 12:23:44	[root] @ localhost [127.0.0.1]	59	0	Connect	root@localhost on doctrine_tests
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	CREATE TABLE DDC2214Line (id INT AUTO_INCREMENT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	CREATE TABLE DDC2214LineRelated (id INT AUTO_INCREMENT NOT NULL, line_id INT NOT NULL, count SMALLINT NOT NULL, line_id_related INT NOT NULL, INDEX IDX_D31307994D7B7542 (line_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	ALTER TABLE DDC2214LineRelated ADD CONSTRAINT FK_D31307994D7B7542 FOREIGN KEY (line_id) REFERENCES DDC2214Line (id)
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	START TRANSACTION
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	INSERT INTO DDC2214Line (id) VALUES (&lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;)
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	INSERT INTO DDC2214Line (id) VALUES (&lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;)
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	INSERT INTO DDC2214Line (id) VALUES (&lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;)
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	INSERT INTO DDC2214LineRelated (count, line_id_related, line_id) VALUES (1, 1, 1)
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	INSERT INTO DDC2214LineRelated (count, line_id_related, line_id) VALUES (2, 2, 2)
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	INSERT INTO DDC2214LineRelated (count, line_id_related, line_id) VALUES (3, 3, 3)
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	COMMIT
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	SELECT t0.id AS id1 FROM DDC2214Line t0 WHERE t0.id = 1 LIMIT 1
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Query	SELECT d0_.id AS id0, d0_.count AS count1, d0_.line_id_related AS line_id_related2, d0_.line_id AS line_id3 FROM DDC2214LineRelated d0_ WHERE d0_.id IN (1, &apos;2&apos;, 3)
2013-01-08 12:23:44	root[root] @ localhost [127.0.0.1]	59	0	Quit	
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;you can see,in database level,the second parameter of last query but two has quote (  (1, &apos;2&apos;, 3)  )&lt;/p&gt;</comment>
                    <comment id="19410" author="beberlei" created="Fri, 25 Jan 2013 16:25:25 +0000"  >&lt;p&gt;A related Github Pull-Request &lt;span class=&quot;error&quot;&gt;&amp;#91;GH-247&amp;#93;&lt;/span&gt; was opened&lt;br/&gt;
&lt;a href=&quot;https://github.com/doctrine/common/pull/247&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/common/pull/247&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="19424" author="beberlei" created="Sat, 26 Jan 2013 23:53:36 +0000"  >&lt;p&gt;A related Github Pull-Request &lt;span class=&quot;error&quot;&gt;&amp;#91;GH-247&amp;#93;&lt;/span&gt; was closed&lt;br/&gt;
&lt;a href=&quot;https://github.com/doctrine/common/pull/247&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/common/pull/247&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11366" name="DDC2214Test.php" size="3004" author="fabio.bat.silva" created="Thu, 27 Dec 2012 19:41:37 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>