Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to exclude id(primary key) in ORM find result?
This is the code:
But id is included in the result.
I tried also this code:
$result = \Model_Test::query()
->select('name', array('id' => false))
But still id is included in the result.
An ORM is not a query builder.
It is a bad thing to use select(),it will create partials objects, and once created, you will never be able to fetch the remaining data. Use it only if you know what you are doing.
An ORM requires the primary key to be present in every object, otherwise it won't know the state of the object, and can't relate it to anything.
If you really only want the name, use the DB query builder:
p.s. If you want an ORM record by it's primary key, use
$result = \Model_Test::find($id);
Add a Comment
It looks like you're new here. If you want to get involved, click one of these buttons!
Apply for Membership
↳ Job Board
↳ Installation & Setup
↳ Tips and Tutorials
↳ Code share
In this Discussion