Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Could someone give me a hint on this relation limit?
  • Okay so i have a bit of a problem, i have videos and vides have as has_many relation for comments, my problem is that my relation limit is ignored, i posted this question, got a hint from Harro, did the way he said (atleast i hope i did) and the limit is still ignored.

    $results = Model_Video::find('all', array(
                'where' => array(
                    array('id', $id),
                    array('video_slug', $slug),
                'related' => array(
                    'videocomments' => array(
                        'order_by' => array(
                            array('id', 'desc'),
                        array('limit' => 5),
    So the problem is it showing all the comments, and i have no clue why, so could please someone give me a hint for this? i would really be grateful

    PS: tried with rows limit thats ignored too
  • HarroHarro
    Accepted Answer
    rows_limit will only work on the query as a whole, not on a relation, as it will limit the entire query. if you want to use that, it has to be defined at the top level of the array, so the same level as 'where' and 'related'.
  • Thank you worked fine, thank you Harro

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion