From ee3e82c15187de7023c93db05254a668fb304600 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sat, 30 Jun 2012 12:10:26 +0200 Subject: [PATCH] Adds two new database object interface. The two new database object interfaces are: - `wcf\data\ILinkableDatabaseObject` - `wcf\data\ITitledDatabaseObject` These interfaces **only** exist to avoid the problem of extending two different interfaces with the same method. For example, a certain database object implements `wcf\system\request\IRouteController` which has a method `getTitle()` and also implements another interface (e.g. `wcf\data\IOtherDatabaseObject`) which requires the same method. PHP can't handle that: `Can't inherit abstract function IRouteableDatabaseObject::getTitle() (previously declared abstract in IOtherDatabaseObject)`. If both interfaces extend the `wcf\data\ITitledDatabaseObject` interface, PHP has no problem and this avoids having to rename the `getTitle()` method in the second interface to a (hopefully) unique name like `getOtherTitle()` which would also pollute the class with methods doing the same thing, just having a different name. --- .../data/ILinkableDatabaseObject.class.php | 21 +++++++++++++++++++ .../lib/data/ITitledDatabaseObject.class.php | 21 +++++++++++++++++++ .../system/request/IRouteController.class.php | 10 ++------- 3 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 wcfsetup/install/files/lib/data/ILinkableDatabaseObject.class.php create mode 100644 wcfsetup/install/files/lib/data/ITitledDatabaseObject.class.php diff --git a/wcfsetup/install/files/lib/data/ILinkableDatabaseObject.class.php b/wcfsetup/install/files/lib/data/ILinkableDatabaseObject.class.php new file mode 100644 index 0000000000..e641fe4c75 --- /dev/null +++ b/wcfsetup/install/files/lib/data/ILinkableDatabaseObject.class.php @@ -0,0 +1,21 @@ + + * @package com.woltlab.wcf + * @subpackage data + * @category Community Framework + */ +interface ILinkableDatabaseObject { + /** + * Returns the link to this database object. + * + * @return string + */ + public function getLink(); +} \ No newline at end of file diff --git a/wcfsetup/install/files/lib/data/ITitledDatabaseObject.class.php b/wcfsetup/install/files/lib/data/ITitledDatabaseObject.class.php new file mode 100644 index 0000000000..f005653019 --- /dev/null +++ b/wcfsetup/install/files/lib/data/ITitledDatabaseObject.class.php @@ -0,0 +1,21 @@ + + * @package com.woltlab.wcf + * @subpackage data + * @category Community Framework + */ +interface ITitledDatabaseObject { + /** + * Returns the title of this database object. + * + * @return string + */ + public function getTitle(); +} \ No newline at end of file diff --git a/wcfsetup/install/files/lib/system/request/IRouteController.class.php b/wcfsetup/install/files/lib/system/request/IRouteController.class.php index 9014e19213..6eb1b09110 100644 --- a/wcfsetup/install/files/lib/system/request/IRouteController.class.php +++ b/wcfsetup/install/files/lib/system/request/IRouteController.class.php @@ -1,5 +1,6 @@