Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2021-03-24 01:09:48 +0300
committerdartcafe <github@dartcafe.de>2021-03-24 01:09:48 +0300
commitd2172cf7a36f834bb96b3e7719cd81a24bf93782 (patch)
treed39ba6597c3cbb5bb9cf704f7c0189a71a5f76a2 /lib
parentfbb41c5b4d256cfb8deaa5d041e6110a4fbcb832 (diff)
fixing all type definitoins
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/Db/Comment.php9
-rw-r--r--lib/Db/Log.php14
-rw-r--r--lib/Db/Poll.php41
-rw-r--r--lib/Db/Preferences.php8
-rw-r--r--lib/Db/Share.php11
-rw-r--r--lib/Db/Subscription.php8
-rw-r--r--lib/Db/Vote.php12
-rw-r--r--lib/Db/Watch.php8
8 files changed, 80 insertions, 31 deletions
diff --git a/lib/Db/Comment.php b/lib/Db/Comment.php
index 435b75e4..8d4d0888 100644
--- a/lib/Db/Comment.php
+++ b/lib/Db/Comment.php
@@ -61,10 +61,15 @@ class Comment extends Entity implements JsonSerializable {
/** @var string $comment */
protected $comment;
+ public function __construct() {
+ $this->addType('pollId', 'integer');
+ $this->addType('timestamp', 'integer');
+ }
+
public function jsonSerialize() {
return [
- 'id' => intval($this->id),
- 'pollId' => intval($this->pollId),
+ 'id' => $this->id,
+ 'pollId' => $this->pollId,
'userId' => $this->userId,
'dt' => $this->dt,
'timestamp' => $this->getTimestamp(),
diff --git a/lib/Db/Log.php b/lib/Db/Log.php
index df669279..2e1dcc56 100644
--- a/lib/Db/Log.php
+++ b/lib/Db/Log.php
@@ -71,12 +71,18 @@ class Log extends Entity implements JsonSerializable {
/** @var string $messageId */
protected $messageId;
+ public function __construct() {
+ $this->addType('pollId', 'integer');
+ $this->addType('created', 'integer');
+ $this->addType('processed', 'integer');
+ }
+
public function jsonSerialize() {
return [
- 'id' => intval($this->id),
- 'pollId' => intval($this->pollId),
- 'created' => intval($this->created),
- 'processed' => intval($this->processed),
+ 'id' => $this->id,
+ 'pollId' => $this->pollId,
+ 'created' => $this->created,
+ 'processed' => $this->processed,
'userId' => $this->userId,
'displayName' => $this->displayName,
'message_id' => $this->messageId
diff --git a/lib/Db/Poll.php b/lib/Db/Poll.php
index 23f38030..c4ac6d46 100644
--- a/lib/Db/Poll.php
+++ b/lib/Db/Poll.php
@@ -155,31 +155,46 @@ class Poll extends Entity implements JsonSerializable {
/** @var int $hideBookedUp*/
protected $hideBookedUp;
+ public function __construct() {
+ $this->addType('created', 'integer');
+ $this->addType('expire', 'integer');
+ $this->addType('deleted', 'integer');
+ $this->addType('anonymous', 'integer');
+ $this->addType('allowComment', 'integer');
+ $this->addType('allowMaybe', 'integer');
+ $this->addType('proposalsExpire', 'integer');
+ $this->addType('voteLimit', 'integer');
+ $this->addType('optionLimit', 'integer');
+ $this->addType('adminAccess', 'integer');
+ $this->addType('important', 'integer');
+ $this->addType('hideBookedUp', 'integer');
+ }
+
public function jsonSerialize() {
return [
- 'id' => intval($this->id),
+ 'id' => $this->id,
'type' => $this->type,
'title' => $this->title,
'description' => $this->description,
'descriptionSafe' => $this->getDescriptionSafe(),
'owner' => $this->owner,
- 'created' => intval($this->created),
- 'expire' => intval($this->expire),
- 'deleted' => intval($this->deleted),
+ 'created' => $this->created,
+ 'expire' => $this->expire,
+ 'deleted' => $this->deleted,
'access' => $this->access,
- 'anonymous' => intval($this->anonymous),
- 'allowComment' => intval($this->allowComment),
- 'allowMaybe' => intval($this->allowMaybe),
+ 'anonymous' => $this->anonymous,
+ 'allowComment' => $this->allowComment,
+ 'allowMaybe' => $this->allowMaybe,
'allowProposals' => $this->allowProposals,
- 'proposalsExpire' => intval($this->proposalsExpire),
+ 'proposalsExpire' => $this->proposalsExpire,
'settings' => $this->settings,
- 'voteLimit' => intval($this->voteLimit),
- 'optionLimit' => intval($this->optionLimit),
+ 'voteLimit' => $this->voteLimit,
+ 'optionLimit' => $this->optionLimit,
'showResults' => $this->showResults === 'expired' ? Poll::SHOW_RESULTS_CLOSED : $this->showResults,
- 'adminAccess' => intVal($this->adminAccess),
+ 'adminAccess' => $this->adminAccess,
'ownerDisplayName' => $this->getDisplayName(),
- 'important' => intVal($this->important),
- 'hideBookedUp' => intVal($this->hideBookedUp)
+ 'important' => $this->important,
+ 'hideBookedUp' => $this->hideBookedUp
];
}
diff --git a/lib/Db/Preferences.php b/lib/Db/Preferences.php
index 3c68f398..4cd8d416 100644
--- a/lib/Db/Preferences.php
+++ b/lib/Db/Preferences.php
@@ -48,11 +48,15 @@ class Preferences extends Entity implements JsonSerializable {
/** @var string $preferences */
protected $preferences;
+ public function __construct() {
+ $this->addType('timestamp', 'integer');
+ }
+
public function jsonSerialize() {
return [
- 'id' => intval($this->id),
+ 'id' => $this->id,
'userId' => $this->userId,
- 'timestamp' => intval($this->timestamp),
+ 'timestamp' => $this->timestamp,
'preferences' => json_decode($this->preferences),
];
}
diff --git a/lib/Db/Share.php b/lib/Db/Share.php
index dd89015c..7be6b0fc 100644
--- a/lib/Db/Share.php
+++ b/lib/Db/Share.php
@@ -85,15 +85,20 @@ class Share extends Entity implements JsonSerializable {
/** @var string $displayName */
protected $displayName;
+ public function __construct() {
+ $this->addType('pollId', 'integer');
+ $this->addType('invitationSent', 'integer');
+ }
+
public function jsonSerialize() {
return [
- 'id' => intval($this->id),
+ 'id' => $this->id,
'token' => $this->token,
'type' => $this->type,
- 'pollId' => intval($this->pollId),
+ 'pollId' => $this->pollId,
'userId' => $this->getUserId(),
'emailAddress' => $this->emailAddress,
- 'invitationSent' => intval($this->invitationSent),
+ 'invitationSent' => $this->invitationSent,
'displayName' => $this->displayName,
'isNoUser' => !($this->type === self::TYPE_USER),
'URL' => $this->getURL()
diff --git a/lib/Db/Subscription.php b/lib/Db/Subscription.php
index ace2ebd5..c7cf4a2e 100644
--- a/lib/Db/Subscription.php
+++ b/lib/Db/Subscription.php
@@ -44,10 +44,14 @@ class Subscription extends Entity implements JsonSerializable {
/** @var string $userId */
protected $userId;
+ public function __construct() {
+ $this->addType('pollId', 'integer');
+ }
+
public function jsonSerialize() {
return [
- 'id' => intval($this->id),
- 'pollId' => intval($this->pollId),
+ 'id' => $this->id,
+ 'pollId' => $this->pollId,
'userId' => $this->userId
];
}
diff --git a/lib/Db/Vote.php b/lib/Db/Vote.php
index 269f3753..c5059b1e 100644
--- a/lib/Db/Vote.php
+++ b/lib/Db/Vote.php
@@ -58,12 +58,18 @@ class Vote extends Entity implements JsonSerializable {
/** @var string $voteAnswer */
protected $voteAnswer;
+ public function __construct() {
+ $this->addType('id', 'integer');
+ $this->addType('pollId', 'integer');
+ $this->addType('voteOptionId', 'integer');
+ }
+
public function jsonSerialize() {
return [
- 'id' => intval($this->id),
- 'pollId' => intval($this->pollId),
+ 'id' => $this->id,
+ 'pollId' => $this->pollId,
'userId' => $this->userId,
- 'voteOptionId' => intval($this->voteOptionId),
+ 'voteOptionId' => $this->voteOptionId,
'voteOptionText' => $this->voteOptionText,
'voteAnswer' => $this->voteAnswer,
'isNoUser' => $this->getIsNoUser(),
diff --git a/lib/Db/Watch.php b/lib/Db/Watch.php
index ea6a518c..c48809c5 100644
--- a/lib/Db/Watch.php
+++ b/lib/Db/Watch.php
@@ -52,10 +52,14 @@ class Watch extends Entity implements JsonSerializable {
/** @var string $updated */
protected $updated;
+ public function __construct() {
+ $this->addType('pollId', 'integer');
+ }
+
public function jsonSerialize() {
return [
- 'id' => intval($this->id),
- 'pollId' => intval($this->pollId),
+ 'id' => $this->id,
+ 'pollId' => $this->pollId,
'table' => $this->table,
'updated' => $this->updated,
];