/** * @see \wcf\action\IAction::execute() */ public function execute() { parent::execute(); // get object ids $objectIDs = $this->getObjectIDs(); // create object action instance $this->objectAction = new $this->parameters['className']($objectIDs, $this->parameters['actionName']); // validate action try { $this->objectAction->validateAction(); } catch (ValidateActionException $e) { throw new AJAXException("validation failed: " . $e->getMessage()); } // execute action try { $this->response = $this->objectAction->executeAction(); } catch (\Exception $e) { throw new AJAXException('unknown exception caught: ' . $e->getMessage()); } $this->executed(); // send JSON-encoded response header('Content-type: application/json'); echo JSON::encode($this->response); exit; }
/** * @see \wcf\action\IAction::execute() */ protected function invoke() { if (!ClassUtil::isInstanceOf($this->className, 'wcf\\data\\IDatabaseObjectAction')) { throw new SystemException("'" . $this->className . "' does not implement 'wcf\\data\\IDatabaseObjectAction'"); } if (!empty($this->interfaceName)) { if (!ClassUtil::isInstanceOf($this->className, $this->interfaceName)) { throw new SystemException("'" . $this->className . "' does not implement '" . $this->interfaceName . "'"); } } // create object action instance $this->objectAction = new $this->className($this->objectIDs, $this->actionName, $this->parameters); // validate action $this->objectAction->validateAction(); // execute action $this->response = $this->objectAction->executeAction(); if (isset($this->response['returnValues'])) { $this->response['returnValues'] = $this->getData($this->response['returnValues']); } }