From 654da24f13a8ba55f493b9f9665012f44b8a753a Mon Sep 17 00:00:00 2001 From: splitt3r Date: Wed, 8 Nov 2017 09:27:51 +0100 Subject: Added type casting to model classes --- lib/Db/Comment.php | 8 ++++++++ lib/Db/Date.php | 8 ++++++++ lib/Db/Event.php | 10 ++++++++++ lib/Db/Notification.php | 8 ++++++++ lib/Db/Participation.php | 9 +++++++++ lib/Db/ParticipationText.php | 9 +++++++++ lib/Db/Text.php | 8 ++++++++ 7 files changed, 60 insertions(+) (limited to 'lib') diff --git a/lib/Db/Comment.php b/lib/Db/Comment.php index bbfb5403..add8c4dc 100644 --- a/lib/Db/Comment.php +++ b/lib/Db/Comment.php @@ -3,6 +3,7 @@ * @copyright Copyright (c) 2017 Vinzenz Rosenkranz * * @author Vinzenz Rosenkranz + * @author Kai Schröer * * @license GNU AGPL version 3 or any later version * @@ -38,4 +39,11 @@ class Comment extends Model { protected $dt; protected $comment; protected $pollId; + + /** + * Comment constructor. + */ + public function __construct() { + $this->addType('pollId', 'integer'); + } } diff --git a/lib/Db/Date.php b/lib/Db/Date.php index 5363ec6a..a4d9894d 100644 --- a/lib/Db/Date.php +++ b/lib/Db/Date.php @@ -3,6 +3,7 @@ * @copyright Copyright (c) 2017 Vinzenz Rosenkranz * * @author Vinzenz Rosenkranz + * @author Kai Schröer * * @license GNU AGPL version 3 or any later version * @@ -32,4 +33,11 @@ namespace OCA\Polls\Db; class Date extends Model { protected $dt; protected $pollId; + + /** + * Date constructor. + */ + public function __construct() { + $this->addType('pollId', 'integer'); + } } diff --git a/lib/Db/Event.php b/lib/Db/Event.php index f422f0b6..8a167495 100644 --- a/lib/Db/Event.php +++ b/lib/Db/Event.php @@ -3,6 +3,7 @@ * @copyright Copyright (c) 2017 Vinzenz Rosenkranz * * @author Vinzenz Rosenkranz + * @author Kai Schröer * * @license GNU AGPL version 3 or any later version * @@ -56,4 +57,13 @@ class Event extends Model { protected $hash; protected $isAnonymous; protected $fullAnonymous; + + /** + * Event constructor. + */ + public function __construct() { + $this->addType('type', 'integer'); + $this->addType('isAnonymous', 'integer'); + $this->addType('fullAnonymous', 'integer'); + } } diff --git a/lib/Db/Notification.php b/lib/Db/Notification.php index d5919551..55ebbb79 100644 --- a/lib/Db/Notification.php +++ b/lib/Db/Notification.php @@ -3,6 +3,7 @@ * @copyright Copyright (c) 2017 Vinzenz Rosenkranz * * @author Vinzenz Rosenkranz + * @author Kai Schröer * * @license GNU AGPL version 3 or any later version * @@ -32,4 +33,11 @@ namespace OCA\Polls\Db; class Notification extends Model { protected $userId; protected $pollId; + + /** + * Notification constructor. + */ + public function __construct() { + $this->addType('pollId', 'integer'); + } } diff --git a/lib/Db/Participation.php b/lib/Db/Participation.php index 317561dc..d22be610 100644 --- a/lib/Db/Participation.php +++ b/lib/Db/Participation.php @@ -3,6 +3,7 @@ * @copyright Copyright (c) 2017 Vinzenz Rosenkranz * * @author Vinzenz Rosenkranz + * @author Kai Schröer * * @license GNU AGPL version 3 or any later version * @@ -38,4 +39,12 @@ class Participation extends Model { protected $userId; protected $pollId; protected $type; + + /** + * Participation constructor. + */ + public function __construct() { + $this->addType('pollId', 'integer'); + $this->addType('type', 'integer'); + } } diff --git a/lib/Db/ParticipationText.php b/lib/Db/ParticipationText.php index 064c50d3..83ef4b52 100644 --- a/lib/Db/ParticipationText.php +++ b/lib/Db/ParticipationText.php @@ -3,6 +3,7 @@ * @copyright Copyright (c) 2017 Vinzenz Rosenkranz * * @author Vinzenz Rosenkranz + * @author Kai Schröer * * @license GNU AGPL version 3 or any later version * @@ -38,4 +39,12 @@ class ParticipationText extends Model { protected $userId; protected $pollId; protected $type; + + /** + * ParticipationText constructor. + */ + public function __construct() { + $this->addType('pollId', 'integer'); + $this->addType('type', 'integer'); + } } diff --git a/lib/Db/Text.php b/lib/Db/Text.php index c888dbdc..9ef423c2 100644 --- a/lib/Db/Text.php +++ b/lib/Db/Text.php @@ -3,6 +3,7 @@ * @copyright Copyright (c) 2017 Vinzenz Rosenkranz * * @author Vinzenz Rosenkranz + * @author Kai Schröer * * @license GNU AGPL version 3 or any later version * @@ -32,4 +33,11 @@ namespace OCA\Polls\Db; class Text extends Model { protected $text; protected $pollId; + + /** + * Text constructor. + */ + public function __construct() { + $this->addType('pollId', 'integer'); + } } -- cgit v1.2.3