Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
orm relationship
  • I have the following 

    $x=$data['loandetails'] = Model_Loandetail::find('all', array(
        'related' => array('statuses'),));

      var_dump($x->statuses);

    i get the below error

    "Trying to get property of non-object, "

    but if i do the following


    $x=$data['loandetails'] = Model_Loandetail::find('1', array(
         'related' => array('statuses'),));

      var_dump($x->statuses);

    it works perfectly, the only difference is firstly i used 'all' to try and retrieve a table defined through a relation and the one which worked i specified the exact id to find.
  • Thank you I have managed to solve it, since I am calling a 1- to- many relationship, it returns the whole result set, including the requested relationship table to access it i have to loop through the result set
  • HarroHarro
    Accepted Answer
    Correct.

    A "find one" returns the object find, a "find many" returns an array of objects. Even if the result is only one object.

Howdy, Stranger!

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

In this Discussion