PHQL doc using controller only?


I am trying to understand the PHQL documentation a bit better but its confuse me.

Under "Creating PHQL Queries" do you see 1 example where it uses Query() in the model so it would be something like

class Foo extends \Phalcon\Mvc\Model {
public function foo2() {
$query = new Phalcon\Mvc\Model\Query("SELECT * FROM Cars", $this->getDI());

// Execute the query returning a result if any
$cars = $query->execute();
return $cars;

But then from the rest of the document does it use modelsManager there is based of using queries inside the controller. Isn't it the point with MVC to run all queries from a Model, pass it to the controller and then to the View ?

Or what am i missing here?

It is up to you on how you want to develop your application.

The debate on whether one should have fat models or fat components has been going on for a long time and frankly it doesn't make a difference which approach you use.

You can use PHQL and Query in a controller to return the data, or you can move that functionality in a function in a model to do the same thing for you and then return it to the controller and then view.