Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
how to use count() in ORM
  • $post = \Model_Language::find('all', array(
       'related' => array('file')
      ));
    

    i want to know count() from file..not all rows from related 'file'.
    this sql will get all rows from file
    is there way to just get count() from file. like $post->file->count
  • It's an ORM, not a query builder, so you can't create custom SQL. If you want to know the number of related records, use
    count($post->file);
    

Howdy, Stranger!

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

In this Discussion