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.

Call to undefined method setVar

Hello, i'm new to Phalcon and im stuck at this point of tutorial,

<?php 
class LoginController extends \Phalcon\Mvc\Controller
{  
    public function indexAction()
    {
        echo "Login";
    }

    // /login/proces/<username/<age>
    public function processAction($username = false, $age = 12)
    {
        $this->setVar('username', $username);
        $this->setVar('age', $age);
    }
}

and get this error:

Fatal error: Call to undefined method LoginController::setVar() in C:\xampp\htdocs\phalcon\app\controllers\LoginController.php on line 14



46.6k
Accepted
answer

$this->view->setVar(...)



46.6k

Is the tutorial documentation wrong?

no, I am blind,

thank you now works fine