Cphalcon: phalcon\mvc\model toArray doesnot work

Created on 30 Mar 2016  路  5Comments  路  Source: phalcon/cphalcon

when i use 'columns' option in the find method,
like

$data = (new model())-> find(array('','columns'=>array('*,count(1) as 'total')));
and then,
print_r($data->array());

not a bug

Most helpful comment

For questions like these please use the forum: http://forum.phalconphp.com/, GitHub is only intended to report bugs and discuss new features.

All 5 comments

there is no method ->array()

Also instead of:

$data = (new model())-> find(array('','columns'=>array('*,count(1) as 'total')));

do:

$data = Model::find(['columns'=>array('*,count(1) as 'total')]);

@sergeyklay
sorry, It's a mistake;
but ,you can try this

$data = Model::find(['columns'=>array('*,count(1) as 'total')]);
var_dump($data->toArray());

it's no an array

$data = Model::find(['columns'=>array('*,count(1) as 'total')]);
var_dump($data->toArray());

This is mistake too, you need it like this:

$data = Model::find(['columns'=>array('*','count(1) as total')]);
var_dump($data->toArray());

For questions like these please use the forum: http://forum.phalconphp.com/, GitHub is only intended to report bugs and discuss new features.

tks 4 help

Was this page helpful?
0 / 5 - 0 ratings