From: Sebastian Teumert Date: Sun, 7 Sep 2014 10:46:41 +0000 (+0200) Subject: Adds the ability to run custom initialization in derived DBOActions. Currently, you... X-Git-Tag: 2.1.0_Alpha_1~328^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=57757c3e5230d4f3bbde48c2fded7e1d78ef76a9;p=GitHub%2FWoltLab%2FWCF.git Adds the ability to run custom initialization in derived DBOActions. Currently, you have to use an event listener with proper nice value to ensure your initialization runs before evrything else. This change allows derived classes to use the initialized values from the constructor but on the same time runs before any 3rd party event listeners. This greatly enhances the flexibility and extensibily of DBOActions. --- diff --git a/wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php b/wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php index 9392632b78..e4215d20af 100644 --- a/wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php +++ b/wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php @@ -141,10 +141,19 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID $this->action = $action; $this->parameters = $parameters; + // initialize further settings + $this->__init($baseClass, $indexName); + // fire event action EventHandler::getInstance()->fireAction($this, 'initializeAction'); } + /** + * This function can be overridden in children to perform custom initialization + * of a DBOAction before the 'initializeAction' event is fired. + */ + protected function __init($baseClass, $indexName) { } + /** * @see \wcf\data\IDatabaseObjectAction::validateAction() */