From: Alexander Ebert Date: Fri, 21 Oct 2011 18:51:28 +0000 (+0200) Subject: additionalData is now properly supported X-Git-Tag: 2.0.0_Beta_1~1668 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7ace033bb4a06d8e1676eb219443c232cda6744c;p=GitHub%2FWoltLab%2FWCF.git additionalData is now properly supported If additional data is an array and contains a serialized array, ObjectType will treat its content as data variables (allows $objectType->foo access) --- diff --git a/wcfsetup/install/files/lib/data/object/type/ObjectType.class.php b/wcfsetup/install/files/lib/data/object/type/ObjectType.class.php index e3ef46d0c0..ce20edb902 100644 --- a/wcfsetup/install/files/lib/data/object/type/ObjectType.class.php +++ b/wcfsetup/install/files/lib/data/object/type/ObjectType.class.php @@ -25,6 +25,22 @@ class ObjectType extends ProcessibleDatabaseObject { */ protected static $databaseTableIndexName = 'objectTypeID'; + /** + * @see wcf\data\IStorableObject::__get() + */ + public function __get($name) { + $value = parent::__get($name); + + // treat additional data as data variables if it is an array + if ($value === null) { + if (is_array($this->additionalData) && isset($this->additionalData[$name])) { + $value = $this->additionalData[$name]; + } + } + + return $value; + } + /** * @see wcf\data\ProcessibleDatabaseObject::getProcessor() */ diff --git a/wcfsetup/install/files/lib/system/cache/builder/ObjectTypeCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/ObjectTypeCacheBuilder.class.php index f03b86c460..c365925f56 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/ObjectTypeCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/ObjectTypeCacheBuilder.class.php @@ -48,6 +48,7 @@ class ObjectTypeCacheBuilder implements ICacheBuilder { $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($packageID)); while ($row = $statement->fetchArray()) { + $row['additionalData'] = unserialize($row['additionalData']); $data['objectTypes'][$row['objectTypeID']] = new ObjectType(null, $row); }