Add basic reaction type database objects
authorJoshua Rüsweg <josh@bastelstu.be>
Mon, 9 Apr 2018 18:32:42 +0000 (20:32 +0200)
committerJoshua Rüsweg <josh@bastelstu.be>
Mon, 9 Apr 2018 18:32:42 +0000 (20:32 +0200)
See #2508

wcfsetup/install/files/lib/data/reaction/type/ReactionType.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/data/reaction/type/ReactionTypeAction.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/data/reaction/type/ReactionTypeEditor.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/data/reaction/type/ReactionTypeList.class.php [new file with mode: 0644]

diff --git a/wcfsetup/install/files/lib/data/reaction/type/ReactionType.class.php b/wcfsetup/install/files/lib/data/reaction/type/ReactionType.class.php
new file mode 100644 (file)
index 0000000..9d443df
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+declare(strict_types=1);
+namespace wcf\data\reaction\type;
+use wcf\data\DatabaseObject;
+
+/**
+ * Represents an object type definition.
+ *
+ * @author     Joshua Ruesweg
+ * @copyright  2001-2018 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    WoltLabSuite\Core\Data\Reaction\Type
+ * @since       3.2
+ *
+ * @property-read      integer         $reactionTypeID         unique id of the reaction type
+ * @property-read      string          $reactionTitle
+ * @property-read      integer         $type                   type of the reaction (1 is positive, 2 is neutral and 3 is negative)
+ * @property-read      integer         $showOrder              position of the reaction type in relation to the other reaction types
+ * @property-read      integer         $iconType               the icon type of the reaction
+ * @property-read      string          $iconFile               the file location of the icon
+ * @property-read      string          $iconName               the icon name
+ * @property-read      string          $iconColor              the icon color
+ * @property-read       integer                $isDisabled             is `1` if the ad is disabled and thus not shown, otherwise `0`
+ */
+class ReactionType extends DatabaseObject {
+       /**
+        * The type value, if this reaction type is a positive reaction.
+        * @var integer
+        */
+       const REACTION_TYPE_POSITIVE = 1;
+       
+       /**
+        * The type value, if this reaction type is a neutral reaction.
+        * @var integer
+        */
+       const REACTION_TYPE_NEUTRAL = 0;
+       
+       /**
+        * The type value, if this reaction type is a negative reaction.
+        * @var integer
+        */
+       const REACTION_TYPE_NEGATIVE = -1;
+       
+       /**
+        * The iconType value, if this reaction type is an image.
+        * @var integer
+        */
+       const ICON_TYPE_IMAGE = 1;
+       
+       /**
+        * The iconType value, if this reaction type is a font icon.
+        * @var integer
+        */
+       const ICON_TYPE_ICON = 2;
+       
+       /**
+        * @inheritDoc
+        */
+       public function getTitle() {
+               return WCF::getLanguage()->get($this->reactionTitle);
+       }
+}
diff --git a/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeAction.class.php b/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeAction.class.php
new file mode 100644 (file)
index 0000000..5a2f3ee
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+declare(strict_types=1);
+namespace wcf\data\reaction\type;
+use wcf\data\AbstractDatabaseObjectAction;
+
+/**
+ * ReactionType related actions.
+ *
+ * @author     Joshua Ruesweg
+ * @copyright  2001-2018 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    WoltLabSuite\Core\Data\Reaction\Type
+ * @since      3.2
+ *
+ * @method     ReactionTypeEditor[]            getObjects()
+ * @method     ReactionTypeEditor              getSingleObject()
+ */
+class ReactionTypeAction extends AbstractDatabaseObjectAction {}
diff --git a/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeEditor.class.php b/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeEditor.class.php
new file mode 100644 (file)
index 0000000..b026a6b
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+declare(strict_types=1);
+namespace wcf\data\reaction\type;
+use wcf\data\DatabaseObjectEditor;
+use wcf\data\IEditableCachedObject;
+
+/**
+ * A reaction type editor.
+ *
+ * @author     Joshua Ruesweg
+ * @copyright  2001-2018 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    WoltLabSuite\Core\Data\Reaction\Type
+ * @since      3.2
+ * 
+ * @mixin      ReactionType
+ */
+class ReactionTypeEditor extends DatabaseObjectEditor implements IEditableCachedObject {
+       /**
+        * @inheritDoc
+        */
+       protected static $baseClass = ReactionType::class;
+       
+       /**
+        * @inheritDoc
+        */
+       public static function resetCache() {
+               // @TODO
+       }
+}
diff --git a/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeList.class.php b/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeList.class.php
new file mode 100644 (file)
index 0000000..85e4ba9
--- /dev/null
@@ -0,0 +1,20 @@
+<?php
+declare(strict_types=1);
+namespace wcf\data\reaction\type;
+use wcf\data\DatabaseObjectList;
+
+/**
+ * Represents a reaction type list. 
+ *
+ * @author     Joshua Ruesweg
+ * @copyright  2001-2018 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    WoltLabSuite\Core\Data\Reaction\Type
+ * @since      3.2
+ *
+ * @method     ReactionType            current()
+ * @method     ReactionType[]          getObjects()
+ * @method     ReactionType|null       search($objectID)
+ * @property   ReactionType[]          $objects
+ */
+class ReactionTypeList extends DatabaseObjectList {}