/** * Execute the action * We will build the class name, require the class and call the execute method. */ public function execute() { // build action-class-name $actionClass = 'Frontend\\Modules\\' . $this->getModule() . '\\Actions\\' . $this->getAction(); if ($this->getModule() == 'Core') { $actionClass = 'Frontend\\Core\\Actions\\' . $this->getAction(); } // validate if class exists (aka has correct name) if (!class_exists($actionClass)) { throw new FrontendException('The action class couldn\'t be found: ' . $actionClass . '.'); } // create action-object $this->object = new $actionClass($this->getKernel(), $this->getModule(), $this->getAction(), $this->getData()); // validate if the execute-method is callable if (!is_callable(array($this->object, 'execute'))) { throw new FrontendException('The action file should contain a callable method "execute".'); } // call the execute method of the real action (defined in the module) $this->object->execute(); // set some properties $this->setOverwrite($this->object->getOverwrite()); if ($this->object->getTemplatePath() !== null) { $this->setTemplatePath($this->object->getTemplatePath()); } }