How do you even get that result without column names in the array?
When I run:
$items = News::find([
'hydration' => \Phalcon\Mvc\Model\Resultset::HYDRATE_OBJECTS
])->toArray();
// Output
Array
(
[0] => Array
(
[id] => 1
[is_active] => 1
[category_id] => 4
[created_at] => 2016-02-02
)
[1] => Array
(
[id] => 2
[is_active] => 1
[category_id] => 10
[created_at] => 2016-02-02
)
)
When I specify columns:
$items = News::find([
'columns' => 'id',
'hydration' => \Phalcon\Mvc\Model\Resultset::HYDRATE_OBJECTS
])->toArray();
// Output
Array
(
[0] => Array
(
[id] => 1
)
[1] => Array
(
[id] => 2
)
)
Your best option would be just to foreach the result and build any custom array format you need. You can even take it one step further by defining a method in a BaseModel which does this. Of course if you need it frequently in your application.