. */ namespace Volkszaehler\Controller; /** * Controller superclass for all controllers * * @author Steffen Vogel * @package default */ abstract class Controller { protected $view; protected $em; /** * Constructor * * @param View $view * @param EntityManager $em */ public function __construct(\Volkszaehler\View\View $view, \Doctrine\ORM\EntityManager $em) { $this->view = $view; $this->em = $em; } /** * Run controller actions * * @param string $action runs the action if class method is available */ public function run($action) { if (!method_exists($this, $action)) { throw new \Exception('\'' . $action . '\' is not a valid controller action'); } $this->$action(); } } ?>