Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Return array
  • Hi,
    I have a table with users (id, email, password, name). When I'm adding new data to the table everything works fine. But when I'm loading data using
    $data = Model_User::find('all');
    I got in return only 2 fields from table (id and password), where is rest of data? Am I doing something wrong?
  • No idea what Model_User is and does, so you have to give a bit more information.
  • It's basic model without relations:

    class Model_User extends Orm\Model
    {
        protected static $_properties = array(
            'id',
            'email',
            'password',
            'name',
            'admin'
        );
    }
  • HarroHarro
    Accepted Answer
    And I assume your table has these fields too?

    If so, this should work without problems:

    $data = Model_User::find('all');
    foreach ($data as $record)
    {
         echo $record->id, $record->email, $record->name, '<br />';
    }

    You can enable profiling in the config.php file, and database profiling in your db.php definition, so you can see exactly which queries are generated by the ORM.

Howdy, Stranger!

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

In this Discussion