Reading the documentation of phalcon https://docs.phalconphp.com/en/3.0.0/reference/views.html I found that it's possible to pass variables from the controller to the view in 2 different ways:
-
Using setVar()
$this->view->setVar("username", $user->username); $this->view->setVar("posts", $posts;
-
Using the magic setter
$this->view->username = $user->username; $this->view->posts = $posts;
What's the difference between the two and what is the magic setter really, I couldn't find what it is.