Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
ORM model related function not working
  • Hi!
    $prod= Model_Product::find("all", array('related' => array('group')));
    $prod = Model_Product::find("all")->related('group')->get(); The first one is working, the second one not. Could you help? Thanks
  • $prod = Model_Product::find()->related('group')->get();
    

    If you pass a param to find() it will be executed immidiately and you can't call related() on the result of an executed find() (either an array or an individual Model instance). Only if you don't give any params to find() will you be able to chain off of it because then it'll return an Orm\Query object which does have a related() method.
  • Thanks for your reply.

Howdy, Stranger!

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

In this Discussion