Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Can I specify some columns instead of the full columns when finding records?

According to the manual, we can specify the columns, by:

Models::find(array('columns' => 'id, title, content. e.g.'));

But how to specify the columns of the Models with hasManytoMany Relationships?


You specify which model

Models::find(['columns' => 'YourProject\Models\', YourProject\Models\YourOtherModel.title']);
edited Mar '16

To find related columns use modelsManager imho. This syntax above imho suck.


Thanks !!