From 57757c3e5230d4f3bbde48c2fded7e1d78ef76a9 Mon Sep 17 00:00:00 2001 From: Sebastian Teumert Date: Sun, 7 Sep 2014 12:46:41 +0200 Subject: [PATCH] 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. --- .../lib/data/AbstractDatabaseObjectAction.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) 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() */ -- 2.20.1