. */ 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 operation * * @param string $operation runs the operation if class method is available */ public function run($operation, array $identifiers = array()) { if (!is_callable(array($this, $operation))) { throw new \Exception('Invalid context operation: ' . $operation); } return call_user_func_array(array($this, $operation), $identifiers); } } ?>