We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Findfirst Inconsistent return objects

so when running findfirst with just an ID i get the whole model back with all the functions.

when running findfirst with more advance finds, i get the Phalcon\Mvc\Model\Row class back.

Why is it not returning the whole model?

//Returns Row class
                'columns'   => 'id, firstName, lastName, userName, created',
                'conditions' => 'firstName = :firstName0: OR firstName = :firstName1:',
                'bind' => [
                    'firstName0' => 'jason',
                    'firstName1' => 'john'

//returns account model class

I can't find where in the documentation it states this, but this is a documented feature.

Basically, if you just ask for all columns in a table, Phalcon returns each row as an instance of the appropriate model. If you only ask for a subset of the rows though, a full model object cannot be created, so it just creates a simple object.

If you want a full model returned for each row, you have to retrieve all columns.

ok good to know. Finding some things in the documentation is frustrating at times. Thanks for the info

For the record, the documentation says so here: https://docs.phalcon.io/en/latest/reference/models.html#finding-records

"When using this option an incomplete object is returned"