Related records not being returned if columns option is specified in Model::find()

Related records will query fine unless I specify specific columns, then it appears that I lose the getRelated() method as well as access to the related records via $model->related_records. Removing the columns definition fixes this problem.

Thoughts?



83.4k

When you set the "columns" parameter, find() returns incomplete objects which does not extend from Phalcon\Mvc\Model thus the getRelated() method is not available. This behavior is mentioned in the docs.

columns: Return specific columns instead of the full columns in the model. When using this option an incomplete object is returned

http://docs.phalconphp.com/en/latest/reference/models.html#finding-records

Alright, that makes sense then. Thanks for the response!



75

the ORM very sick