Creacion route

Hola Necesito crear los routers desde los controladores,


     class BaseController extends Phalcon\Mvc\Controller {
        protected function registerController(){
            $router = new Phalcon\Mvc\Router();

            $router->add(
                "/",
                array(
                        "controller" => "index",
                        "action"     => "get"));
        }
    }

  class IndexController extends BaseController{
        public function Initialize(){
            $this->registerController(); 
        }

        public function getAction(){
            echo "entroooooooooo";
        }
    }

Gracias

It won't work. You have to define your routes in bootstrap before use them.

$di['router']=function() {
   $router = new Phalcon\Mvc\Router();
   $router->add(
                "/",
                array(
                        "controller" => "index",
                        "action"     => "get")
    );
    return $router;
}

If you have to define routes in controllers you have to use Annotations Router. http://docs.phalconphp.com/en/latest/reference/routing.html#annotations-router