Drills : Search by a HAS_MANY relation in Yii 1.1

Comparing #18 with #19

Revision #19 was created by softark softark on Sep 29, 2018, 11:46:41 PM.

Changed markup for query results from "code" to "list"

Content

[...]
What about this? Seems OK. You will not see the error anymore.

But, alas, you will get the strange output like this:

-    [search word = **foo]
 
   
**
 
-
Author = Andy    - Post = Don't use **foo**    - Post = Use yoo for **foo
 
   
**
 
-
Author = Ben    - Post = **foo** is great    - Post = I love **foo
 
   
**
 
-
Author = Charlie    - Post = What's **foo**? -    [end]

We want to show 5 authors, but the list ends where the count of posts sums up to 5.
[...]
But it still doesn't work. It will show the results like this:

-    [search word = **foo]
 
   
**
 
-
Author = Andy    - Post = Don't use **foo
 
       
**
 
-
Post = Use yoo for **foo    **    - Post = Don't use bar    - Post = Use yar for bar    - Author = Ben    - Post = **foo** is great    - Post = I love **foo**    - Post = I also love bar    - Author = Charlie    - Post = What's **foo**?    - Post = What's bar? -    [end]

It is because LIMIT is not applied to the primary table, but to the virtually constructed table that is the result of joining. It's no use complaining about this behavior, because that's how the query works in RDB.

But we won't give up. Let's try grouping then.
[...]