summaryrefslogtreecommitdiffstats
path: root/lib/Db/Folder.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Db/Folder.php')
-rw-r--r--lib/Db/Folder.php158
1 files changed, 121 insertions, 37 deletions
diff --git a/lib/Db/Folder.php b/lib/Db/Folder.php
index 4a6ec8ba1..07fa7b369 100644
--- a/lib/Db/Folder.php
+++ b/lib/Db/Folder.php
@@ -13,67 +13,151 @@
namespace OCA\News\Db;
-use \OCP\AppFramework\Db\Entity;
+use OCP\AppFramework\Db\Entity;
-/**
- * @method integer getId()
- * @method void setId(integer $value)
- * @method string getUserId()
- * @method void setUserId(string $value)
- * @method string getName()
- * @method void setName(string $value)
- * @method integer getParentId()
- * @method void setParentId(integer $value)
- * @method boolean getOpened()
- * @method void setOpened(boolean $value)
- * @method integer getDeletedAt()
- * @method void setDeletedAt(integer $value)
- * @method string getLastModified()
- * @method void setLastModified(string $value)
- */
class Folder extends Entity implements IAPI, \JsonSerializable
{
use EntityJSONSerializer;
+ /** @var int|null */
protected $parentId;
+ /** @var string */
protected $name;
- protected $userId;
- protected $opened;
- protected $deletedAt;
- protected $lastModified;
+ /** @var string */
+ protected $userId = '';
+ /** @var bool */
+ protected $opened = true;
+ /** @var int|null */
+ protected $deletedAt = 0;
+ /** @var int|null */
+ protected $lastModified = 0;
+
+ /**
+ * @return int|null
+ */
+ public function getDeletedAt()
+ {
+ return $this->deletedAt;
+ }
+
+ public function getId(): int
+ {
+ return $this->id;
+ }
+
+ /**
+ * @return int|null
+ */
+ public function getLastModified()
+ {
+ return $this->lastModified;
+ }
+
+ public function getName(): string
+ {
+ return $this->name;
+ }
+
+ public function getOpened(): bool
+ {
+ return $this->opened;
+ }
+
+ /**
+ * @return int|null
+ */
+ public function getParentId()
+ {
+ return $this->parentId;
+ }
- public function __construct()
+ public function getUserId(): string
{
- $this->addType('parentId', 'integer');
- $this->addType('opened', 'boolean');
- $this->addType('deletedAt', 'integer');
+ return $this->userId;
}
/**
- * Turns entitie attributes into an array
+ * Turns entity attributes into an array
*/
- public function jsonSerialize()
+ public function jsonSerialize(): array
{
return $this->serializeFields(
[
- 'id',
- 'parentId',
- 'name',
- 'userId',
- 'opened',
- 'deletedAt',
+ 'id',
+ 'parentId',
+ 'name',
+ 'userId',
+ 'opened',
+ 'deletedAt',
]
);
}
- public function toAPI()
+ public function setDeletedAt(int $deletedAt = null)
+ {
+ if ($this->deletedAt !== $deletedAt) {
+ $this->deletedAt = $deletedAt;
+ $this->markFieldUpdated('deletedAt');
+ }
+ }
+
+ public function setId(int $id)
+ {
+ if ($this->id !== $id) {
+ $this->id = $id;
+ $this->markFieldUpdated('id');
+ }
+ }
+
+ public function setLastModified(int $lastModified = null)
+ {
+
+ if ($this->lastModified !== $lastModified) {
+ $this->lastModified = $lastModified;
+ $this->markFieldUpdated('lastModified');
+ }
+ }
+
+ public function setName(string $name)
+ {
+ if ($this->name !== $name) {
+ $this->name = $name;
+ $this->markFieldUpdated('name');
+ }
+ }
+
+ public function setOpened(bool $opened)
+ {
+ if ($this->opened !== $opened) {
+ $this->opened = $opened;
+ $this->markFieldUpdated('opened');
+ }
+ }
+
+ public function setParentId(int $parentId = null)
+ {
+ if ($this->parentId !== $parentId) {
+ $this->parentId = $parentId;
+ $this->markFieldUpdated('parentId');
+ }
+ }
+
+ public function setUserId(string $userId)
+ {
+ if ($this->userId !== $userId) {
+ $this->userId = $userId;
+ $this->markFieldUpdated('userId');
+ }
+ }
+
+ public function toAPI(): array
{
return $this->serializeFields(
[
- 'id',
- 'name'
+ 'id',
+ 'name'
]
);
}
-} \ No newline at end of file
+}