Files
quicknotes/lib/Db/Note.php
Matias De lellis af37467128 More return types
2021-09-20 21:39:10 -03:00

83 lines
1.8 KiB
PHP

<?php
namespace OCA\QuickNotes\Db;
use JsonSerializable;
use OCP\AppFramework\Db\Entity;
/**
* @method string getUserId()
* @method void setUserId(string $userId)
* @method string getTitle()
* @method void setTitle(string $title)
* @method string getContent()
* @method void setContent(string $content)
* @method int getTimestamp()
* @method void setTimestamp(int $timestamp)
* @method int getColorId()
* @method void setColorId(int $colorId)
* @method bool getPinned()
* @method void setPinned(bool $pinned)
*/
class Note extends Entity implements JsonSerializable {
// Db Entity
protected $userId;
protected $title;
protected $content;
protected $timestamp;
protected $colorId;
protected $pinned;
// Extra info to API
protected $color;
protected $isPinned;
protected $sharedWith = [];
protected $sharedBy = [];
protected $tags = [];
protected $attachts = [];
public function __construct() {
$this->addType('pinned', 'boolean');
}
public function setColor(string $color): void {
$this->color = $color;
}
public function setIsPinned(bool $pinned): void {
$this->isPinned = $pinned;
}
public function setSharedWith(array $sharedWith): void {
$this->sharedWith = $sharedWith;
}
public function setSharedBy(array $sharedBy): void {
$this->sharedBy = $sharedBy;
}
public function setTags(array $tags): void {
$this->tags = $tags;
}
public function setAttachts(array $attachts): void {
$this->attachts = $attachts;
}
public function jsonSerialize() {
return [
'id' => $this->id,
'title' => $this->title,
'content' => $this->content,
'isPinned' => $this->isPinned,
'timestamp' => $this->timestamp,
'color' => $this->color,
'sharedWith' => $this->sharedWith,
'sharedBy' => $this->sharedBy,
'tags' => $this->tags,
'attachments' => $this->attachts
];
}
}