Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Orm
Return array
Niedzielnya
November 2017
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?
Harro
November 2017
No idea what Model_User is and does, so you have to give a bit more information.
Niedzielnya
November 2017
It's basic model without relations:
class Model_User extends Orm\Model
{
protected static $_properties = array(
'id',
'email',
'password',
'name',
'admin'
);
}
Harro
November 2017
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.
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
November 2017
Niedzielnya
November 2017