change attributes regarding null values
Signed-off-by: dartcafe <github@dartcafe.de>
This commit is contained in:
Родитель
bf2c39ff2a
Коммит
3da60e4457
|
@ -47,7 +47,7 @@ class Comment extends EntityWithUser implements JsonSerializable {
|
|||
protected int $pollId = 0;
|
||||
protected string $userId = '';
|
||||
protected int $timestamp = 0;
|
||||
protected string $comment = '';
|
||||
protected ?string $comment = null;
|
||||
|
||||
public function __construct() {
|
||||
$this->addType('pollId', 'int');
|
||||
|
|
|
@ -95,10 +95,10 @@ class Share extends Entity implements JsonSerializable {
|
|||
protected string $token = '';
|
||||
protected string $type = '';
|
||||
protected string $userId = '';
|
||||
protected string $emailAddress = '';
|
||||
protected ?string $emailAddress = null;
|
||||
protected string $invitationSent = '';
|
||||
protected string $reminderSent = '';
|
||||
protected string $displayName = '';
|
||||
protected ?string $displayName = null;
|
||||
protected ?string $miscSettings = '';
|
||||
|
||||
public function __construct() {
|
||||
|
@ -134,15 +134,15 @@ class Share extends Entity implements JsonSerializable {
|
|||
return $this->getMiscSettingsArray()['publicPollEmail'] ?? 'optional';
|
||||
}
|
||||
|
||||
public function setPublicPollEmail(string $value) : void {
|
||||
public function setPublicPollEmail(string $value): void {
|
||||
$this->setMiscSettingsByKey('publicPollEmail', $value);
|
||||
}
|
||||
|
||||
public function getTimeZoneName() : string {
|
||||
public function getTimeZoneName(): string {
|
||||
return $this->getMiscSettingsArray()['timeZone'] ?? '';
|
||||
}
|
||||
|
||||
public function setTimeZoneName(string $value) : void {
|
||||
public function setTimeZoneName(string $value): void {
|
||||
$this->setMiscSettingsByKey('timeZone', $value);
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ class Share extends Entity implements JsonSerializable {
|
|||
return $this->getLanguage();
|
||||
}
|
||||
|
||||
public function setLanguage(string $value) : void {
|
||||
public function setLanguage(string $value): void {
|
||||
$this->setMiscSettingsByKey('language', $value);
|
||||
}
|
||||
|
||||
|
@ -194,15 +194,14 @@ class Share extends Entity implements JsonSerializable {
|
|||
];
|
||||
}
|
||||
|
||||
private function setMiscSettingsArray(array $value) : void {
|
||||
private function setMiscSettingsArray(array $value): void {
|
||||
$this->setMiscSettings(json_encode($value));
|
||||
}
|
||||
|
||||
private function getMiscSettingsArray() : array {
|
||||
private function getMiscSettingsArray(): array {
|
||||
if ($this->getMiscSettings()) {
|
||||
return json_decode($this->getMiscSettings(), true);
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 René Gieling <github@dartcafe.de>
|
||||
*
|
||||
|
@ -149,7 +150,7 @@ abstract class TableSchema {
|
|||
'type' => ['type' => Types::STRING, 'options' => ['notnull' => true, 'default' => 'datePoll', 'length' => 64]],
|
||||
'title' => ['type' => Types::STRING, 'options' => ['notnull' => true, 'default' => '', 'length' => 128]],
|
||||
'description' => ['type' => Types::TEXT, 'options' => ['notnull' => false, 'default' => null, 'length' => 65535]],
|
||||
'owner' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 256]],
|
||||
'owner' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => null, 'length' => 256]],
|
||||
'created' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
'expire' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
'deleted' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
|
@ -166,13 +167,13 @@ abstract class TableSchema {
|
|||
'allow_proposals' => ['type' => Types::STRING, 'options' => ['notnull' => true, 'default' => 'disallow', 'length' => 64]],
|
||||
'use_no' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 1, 'length' => 20]],
|
||||
'proposals_expire' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
'misc_settings' => ['type' => Types::TEXT, 'options' => ['notnull' => false, 'default' => '', 'length' => 65535]],
|
||||
'misc_settings' => ['type' => Types::TEXT, 'options' => ['notnull' => false, 'default' => null, 'length' => 65535]],
|
||||
],
|
||||
Option::TABLE => [
|
||||
'id' => ['type' => Types::BIGINT, 'options' => ['autoincrement' => true, 'notnull' => true, 'length' => 20]],
|
||||
'poll_id' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
'poll_option_text' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 1024]],
|
||||
'poll_option_hash' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 256]],
|
||||
'poll_option_text' => ['type' => Types::STRING, 'options' => ['notnull' => true, 'default' => '', 'length' => 1024]],
|
||||
'poll_option_hash' => ['type' => Types::STRING, 'options' => ['notnull' => true, 'default' => '', 'length' => 256]],
|
||||
'timestamp' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
'duration' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
'order' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
|
@ -183,58 +184,57 @@ abstract class TableSchema {
|
|||
Vote::TABLE => [
|
||||
'id' => ['type' => Types::BIGINT, 'options' => ['autoincrement' => true, 'notnull' => true, 'length' => 20]],
|
||||
'poll_id' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
'user_id' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 256]],
|
||||
'user_id' => ['type' => Types::STRING, 'options' => ['notnull' => true, 'default' => '', 'length' => 256]],
|
||||
'vote_option_id' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
'vote_option_text' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 1024]],
|
||||
'vote_option_hash' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 256]],
|
||||
'vote_answer' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 64]],
|
||||
'vote_option_text' => ['type' => Types::STRING, 'options' => ['notnull' => true, 'default' => '', 'length' => 1024]],
|
||||
'vote_option_hash' => ['type' => Types::STRING, 'options' => ['notnull' => true, 'default' => '', 'length' => 256]],
|
||||
'vote_answer' => ['type' => Types::STRING, 'options' => ['notnull' => true, 'default' => '', 'length' => 64]],
|
||||
],
|
||||
Comment::TABLE => [
|
||||
'id' => ['type' => Types::BIGINT, 'options' => ['autoincrement' => true, 'notnull' => true, 'length' => 20]],
|
||||
'poll_id' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
'user_id' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 256]],
|
||||
'comment' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 1024]],
|
||||
'user_id' => ['type' => Types::STRING, 'options' => ['notnull' => true, 'default' => '', 'length' => 256]],
|
||||
'comment' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => null, 'length' => 1024]],
|
||||
'timestamp' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
|
||||
],
|
||||
Share::TABLE => [
|
||||
'id' => ['type' => Types::BIGINT, 'options' => ['autoincrement' => true, 'notnull' => true, 'length' => 20]],
|
||||
'token' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 64]],
|
||||
'type' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 64]],
|
||||
'token' => ['type' => Types::STRING, 'options' => ['notnull' => true, 'default' => '', 'length' => 64]],
|
||||
'type' => ['type' => Types::STRING, 'options' => ['notnull' => true, 'default' => '', 'length' => 64]],
|
||||
'poll_id' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
'user_id' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 256]],
|
||||
'display_name' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 256]],
|
||||
'email_address' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 256]],
|
||||
'user_id' => ['type' => Types::STRING, 'options' => ['notnull' => true, 'default' => '', 'length' => 256]],
|
||||
'display_name' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => null, 'length' => 256]],
|
||||
'email_address' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => null, 'length' => 256]],
|
||||
'invitation_sent' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
'reminder_sent' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
'misc_settings' => ['type' => Types::TEXT, 'options' => ['notnull' => false, 'default' => '', 'length' => 65535]],
|
||||
'misc_settings' => ['type' => Types::TEXT, 'options' => ['notnull' => false, 'default' => null, 'length' => 65535]],
|
||||
],
|
||||
Subscription::TABLE => [
|
||||
'id' => ['type' => Types::BIGINT, 'options' => ['autoincrement' => true, 'notnull' => true, 'length' => 20]],
|
||||
'poll_id' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
'user_id' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 256]],
|
||||
'user_id' => ['type' => Types::STRING, 'options' => ['notnull' => true, 'default' => '', 'length' => 256]],
|
||||
],
|
||||
Log::TABLE => [
|
||||
'id' => ['type' => Types::BIGINT, 'options' => ['autoincrement' => true, 'notnull' => true, 'length' => 20]],
|
||||
'poll_id' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
'user_id' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 256]],
|
||||
'display_name' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 256]],
|
||||
'message_id' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 64]],
|
||||
'user_id' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => null, 'length' => 256]],
|
||||
'display_name' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => null, 'length' => 256]],
|
||||
'message_id' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => null, 'length' => 64]],
|
||||
'created' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
'processed' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
],
|
||||
Watch::TABLE => [
|
||||
'id' => ['type' => Types::BIGINT, 'options' => ['autoincrement' => true, 'notnull' => true, 'length' => 20]],
|
||||
'poll_id' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
'table' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 64]],
|
||||
'table' => ['type' => Types::STRING, 'options' => ['notnull' => true, 'default' => '', 'length' => 64]],
|
||||
'updated' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
'session_id' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => null]],
|
||||
'session_id' => ['type' => Types::STRING, 'options' => ['notnull' => true, 'default' => null]],
|
||||
],
|
||||
Preferences::TABLE => [
|
||||
'id' => ['type' => Types::BIGINT, 'options' => ['autoincrement' => true, 'notnull' => true, 'length' => 20]],
|
||||
'user_id' => ['type' => Types::STRING, 'options' => ['notnull' => false, 'default' => '', 'length' => 256]],
|
||||
'user_id' => ['type' => Types::STRING, 'options' => ['notnull' => true, 'default' => '', 'length' => 256]],
|
||||
'timestamp' => ['type' => Types::BIGINT, 'options' => ['notnull' => true, 'default' => 0, 'length' => 20]],
|
||||
'preferences' => ['type' => Types::TEXT, 'options' => ['notnull' => false, 'default' => '', 'length' => 65535]],
|
||||
'preferences' => ['type' => Types::TEXT, 'options' => ['notnull' => false, 'default' => null, 'length' => 65535]],
|
||||
],
|
||||
];
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче