doctrine2 - Getting odd behavior from $query->setMaxResults() -


When I call setMaxResults on a query, it wants to treat the maximum number as "2" Regardless of whoever is real value

  function findMostRecentByOwnerUser (\ Entities \ user $ user, $ border) {resonant "2: $ limit 
"; $ Query = $ this- & gt; GetEntityManager () - & gt; Security ('Select from Institutions' Thread TJnnetT.Message is joining Teahu GroupG where G. User User:: Order for the owner by MEMSTamp DESC) ;; $ Query-> Setpalmator ("owner_gier", $ user); $ Query-> SetMaxResults (4); Repeat $ query- & gt; GetSQL () "& Lt; br & gt;"; $ Result = $ query- & gt; GetResult (); Echo "3:". Count ($ result); Returns $ results; } When I exclude the setMaxResults line, I get 6 results. When I leave it, I get 2 most recent results. When I run the generated SQL code in phpMyAdmin, I get 4 most recent results. The generated SQL for reference is:
  SELECT & lt; Too many columns, all T0_ & gt; T0_iner join message from thread m1_ ON t0_.id = m1_.thread_id inner join group g2_ ON t0_.group_id = g2_.id WHERE g2_.ownerUser_id =? By reading m1_.timestamp DESC LIMIT 4   

edit :

While reading, I came to the following:

If your query contains a fetch linked collection, the range of results are being specified which are what you expect. Set maximum results, the database restricts the number of result rows, however in case of a fetch-related archive a root unit can appear in multiple rows, it can be effectively hydrated by the specified number of results.

I'm pretty sure that I'm not collecting a patch attached. I am under the assumption that there is a fetch linked collection, where I do something like SELECT t, join the thread t.messages . Am I wrong in my understanding about this?

An update: You can use the paginator with the principle 2.2+

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -