Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Is there something similar to Kohana's $orm_model->loaded property?
  • Kohana ORM has "loaded" property which turns true if the object was loaded from from database... is there something similar in Fuel's ORM?
  • You could use $model->is_new()...
  • Harro Verton wrote on Tuesday 17th of January 2012:
    You could use $model->is_new()...

    Hmm so if I understand this right... if I load user with ID=5 from DB like $user = Model_User::find(5), then $user->is_new() would return true if user was loaded from DB or false, if user with id 5 does not exist?
  • No. is_new() is true when an object doesn't have a primary key, i.e. is has never been saved before. That includes an "empty" model. If you find a record, is_new() returns false as the object has a primary key. If you do a find and you get no results, there are no results.

Howdy, Stranger!

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

In this Discussion