Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Orm Model with dynamic/generated properties
  • Hello all, I have an orm model that I would like to have generated properties.
    class Model_User extends \Orm\Model
    {
     protected static $_properties = array(
      'id',
      'first_name',
      'last_name',
      'created_at',
      'updated_at'
     );
    }
    

    How could I create a property that does NOT exist in database? For Example:
    $user = Model_User::find(1);
    $user->full_name = $user->first_name.' '.$user->last_name;
    

    Please note that this is a simplified example. My true goal is to store the result of a subquery.
  • Adding custom properties has been added in 1.4/develop, so if you require that you'll have to switch versions. This version will work fine with a 1.3 core.
  • Thanks, I'll check it out

Howdy, Stranger!

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

In this Discussion