Controllers are defined inside the application/controllers directory and extend the FrontController class. The ErrorController, found below, contains one action called the indexAction(). This results in a valid url that is a combination of the controller name and action name, therefore /Error/index/ or simply Error/ is valid, since index is the default starting point of any controller.
<?php
class ErrorController extends FrontController
{
/**
* Initialization
*
*/
public function initialize()
{
$this->addRoute($this->action);
$this->view->renderer("Index", "error");
}
/**
* URL: Error/index/
* Alias: error/
*
* @param string $type the error code to display within the error template
* @return View
*/
public function indexAction($type = "")
{
$this->view->title = "Error " .$type;
$this->view->type = $type;
return $this->view();
}
} /*end of class ErrorController*/Any phpdoc definitions are completely optional and are only used to help describe what the controller is doing. Annotations in controllers are only important for more complex use cases, such as the annotated controller example.