@@ -31,13 +31,13 @@ |
||
| 31 | 31 | * @method void setPollId(integer $value) |
| 32 | 32 | */ |
| 33 | 33 | class Text extends Model { |
| 34 | - protected $text; |
|
| 35 | - protected $pollId; |
|
| 34 | + protected $text; |
|
| 35 | + protected $pollId; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Text constructor. |
|
| 39 | - */ |
|
| 40 | - public function __construct() { |
|
| 41 | - $this->addType('pollId', 'integer'); |
|
| 42 | - } |
|
| 37 | + /** |
|
| 38 | + * Text constructor. |
|
| 39 | + */ |
|
| 40 | + public function __construct() { |
|
| 41 | + $this->addType('pollId', 'integer'); |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -47,23 +47,23 @@ |
||
| 47 | 47 | * @method void setFullAnonymous(integer $value) |
| 48 | 48 | */ |
| 49 | 49 | class Event extends Model { |
| 50 | - protected $type; |
|
| 51 | - protected $title; |
|
| 52 | - protected $description; |
|
| 53 | - protected $owner; |
|
| 54 | - protected $created; |
|
| 55 | - protected $access; |
|
| 56 | - protected $expire; |
|
| 57 | - protected $hash; |
|
| 58 | - protected $isAnonymous; |
|
| 59 | - protected $fullAnonymous; |
|
| 50 | + protected $type; |
|
| 51 | + protected $title; |
|
| 52 | + protected $description; |
|
| 53 | + protected $owner; |
|
| 54 | + protected $created; |
|
| 55 | + protected $access; |
|
| 56 | + protected $expire; |
|
| 57 | + protected $hash; |
|
| 58 | + protected $isAnonymous; |
|
| 59 | + protected $fullAnonymous; |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Event constructor. |
|
| 63 | - */ |
|
| 64 | - public function __construct() { |
|
| 65 | - $this->addType('type', 'integer'); |
|
| 66 | - $this->addType('isAnonymous', 'integer'); |
|
| 67 | - $this->addType('fullAnonymous', 'integer'); |
|
| 68 | - } |
|
| 61 | + /** |
|
| 62 | + * Event constructor. |
|
| 63 | + */ |
|
| 64 | + public function __construct() { |
|
| 65 | + $this->addType('type', 'integer'); |
|
| 66 | + $this->addType('isAnonymous', 'integer'); |
|
| 67 | + $this->addType('fullAnonymous', 'integer'); |
|
| 68 | + } |
|
| 69 | 69 | } |
@@ -31,13 +31,13 @@ |
||
| 31 | 31 | * @method void setPollId(integer $value) |
| 32 | 32 | */ |
| 33 | 33 | class Date extends Model { |
| 34 | - protected $dt; |
|
| 35 | - protected $pollId; |
|
| 34 | + protected $dt; |
|
| 35 | + protected $pollId; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Date constructor. |
|
| 39 | - */ |
|
| 40 | - public function __construct() { |
|
| 41 | - $this->addType('pollId', 'integer'); |
|
| 42 | - } |
|
| 37 | + /** |
|
| 38 | + * Date constructor. |
|
| 39 | + */ |
|
| 40 | + public function __construct() { |
|
| 41 | + $this->addType('pollId', 'integer'); |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -35,15 +35,15 @@ |
||
| 35 | 35 | * @method void setPollId(integer $value) |
| 36 | 36 | */ |
| 37 | 37 | class Comment extends Model { |
| 38 | - protected $userId; |
|
| 39 | - protected $dt; |
|
| 40 | - protected $comment; |
|
| 41 | - protected $pollId; |
|
| 38 | + protected $userId; |
|
| 39 | + protected $dt; |
|
| 40 | + protected $comment; |
|
| 41 | + protected $pollId; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Comment constructor. |
|
| 45 | - */ |
|
| 46 | - public function __construct() { |
|
| 47 | - $this->addType('pollId', 'integer'); |
|
| 48 | - } |
|
| 43 | + /** |
|
| 44 | + * Comment constructor. |
|
| 45 | + */ |
|
| 46 | + public function __construct() { |
|
| 47 | + $this->addType('pollId', 'integer'); |
|
| 48 | + } |
|
| 49 | 49 | } |
@@ -28,61 +28,61 @@ |
||
| 28 | 28 | |
| 29 | 29 | class ParticipationTextMapper extends Mapper { |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * ParticipationTextMapper constructor. |
|
| 33 | - * @param IDBConnection $db |
|
| 34 | - */ |
|
| 35 | - public function __construct(IDBConnection $db) { |
|
| 36 | - parent::__construct($db, 'polls_particip_text', '\OCA\Polls\Db\ParticipationText'); |
|
| 37 | - } |
|
| 31 | + /** |
|
| 32 | + * ParticipationTextMapper constructor. |
|
| 33 | + * @param IDBConnection $db |
|
| 34 | + */ |
|
| 35 | + public function __construct(IDBConnection $db) { |
|
| 36 | + parent::__construct($db, 'polls_particip_text', '\OCA\Polls\Db\ParticipationText'); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param int $pollId |
|
| 41 | - * @param int $limit |
|
| 42 | - * @param int $offset |
|
| 43 | - * @return ParticipationText[] |
|
| 44 | - */ |
|
| 45 | - public function findByPoll($pollId, $limit = null, $offset = null) { |
|
| 46 | - $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
| 47 | - return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
| 48 | - } |
|
| 39 | + /** |
|
| 40 | + * @param int $pollId |
|
| 41 | + * @param int $limit |
|
| 42 | + * @param int $offset |
|
| 43 | + * @return ParticipationText[] |
|
| 44 | + */ |
|
| 45 | + public function findByPoll($pollId, $limit = null, $offset = null) { |
|
| 46 | + $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
| 47 | + return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @param string $userId |
|
| 52 | - * @param int $limit |
|
| 53 | - * @param int $offset |
|
| 54 | - * @return ParticipationText[] |
|
| 55 | - */ |
|
| 56 | - public function findDistinctByUser($userId, $limit = null, $offset = null) { |
|
| 57 | - $sql = 'SELECT DISTINCT * FROM ' . $this->getTableName() . ' WHERE user_id = ?'; |
|
| 58 | - return $this->findEntities($sql, [$userId], $limit, $offset); |
|
| 59 | - } |
|
| 50 | + /** |
|
| 51 | + * @param string $userId |
|
| 52 | + * @param int $limit |
|
| 53 | + * @param int $offset |
|
| 54 | + * @return ParticipationText[] |
|
| 55 | + */ |
|
| 56 | + public function findDistinctByUser($userId, $limit = null, $offset = null) { |
|
| 57 | + $sql = 'SELECT DISTINCT * FROM ' . $this->getTableName() . ' WHERE user_id = ?'; |
|
| 58 | + return $this->findEntities($sql, [$userId], $limit, $offset); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * @param int $pollId |
|
| 63 | - * @param int $limit |
|
| 64 | - * @param int $offset |
|
| 65 | - * @return ParticipationText[] |
|
| 66 | - */ |
|
| 67 | - public function findParticipantsByPoll($pollId, $limit = null, $offset = null) { |
|
| 68 | - $sql = 'SELECT DISTINCT user_id FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
| 69 | - return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
| 70 | - } |
|
| 61 | + /** |
|
| 62 | + * @param int $pollId |
|
| 63 | + * @param int $limit |
|
| 64 | + * @param int $offset |
|
| 65 | + * @return ParticipationText[] |
|
| 66 | + */ |
|
| 67 | + public function findParticipantsByPoll($pollId, $limit = null, $offset = null) { |
|
| 68 | + $sql = 'SELECT DISTINCT user_id FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
| 69 | + return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * @param int $pollId |
|
| 74 | - */ |
|
| 75 | - public function deleteByPoll($pollId) { |
|
| 76 | - $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
| 77 | - $this->execute($sql, [$pollId]); |
|
| 78 | - } |
|
| 72 | + /** |
|
| 73 | + * @param int $pollId |
|
| 74 | + */ |
|
| 75 | + public function deleteByPoll($pollId) { |
|
| 76 | + $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
| 77 | + $this->execute($sql, [$pollId]); |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * @param int $pollId |
|
| 82 | - * @param string $userId |
|
| 83 | - */ |
|
| 84 | - public function deleteByPollAndUser($pollId, $userId) { |
|
| 85 | - $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ? AND user_id = ?'; |
|
| 86 | - $this->execute($sql, [$pollId, $userId]); |
|
| 87 | - } |
|
| 80 | + /** |
|
| 81 | + * @param int $pollId |
|
| 82 | + * @param string $userId |
|
| 83 | + */ |
|
| 84 | + public function deleteByPollAndUser($pollId, $userId) { |
|
| 85 | + $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ? AND user_id = ?'; |
|
| 86 | + $this->execute($sql, [$pollId, $userId]); |
|
| 87 | + } |
|
| 88 | 88 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function findByPoll($pollId, $limit = null, $offset = null) { |
| 46 | 46 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
| 47 | - return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
| 47 | + return $this->findEntities($sql, [ $pollId ], $limit, $offset); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function findDistinctByUser($userId, $limit = null, $offset = null) { |
| 57 | 57 | $sql = 'SELECT DISTINCT * FROM ' . $this->getTableName() . ' WHERE user_id = ?'; |
| 58 | - return $this->findEntities($sql, [$userId], $limit, $offset); |
|
| 58 | + return $this->findEntities($sql, [ $userId ], $limit, $offset); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function findParticipantsByPoll($pollId, $limit = null, $offset = null) { |
| 68 | 68 | $sql = 'SELECT DISTINCT user_id FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
| 69 | - return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
| 69 | + return $this->findEntities($sql, [ $pollId ], $limit, $offset); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function deleteByPoll($pollId) { |
| 76 | 76 | $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
| 77 | - $this->execute($sql, [$pollId]); |
|
| 77 | + $this->execute($sql, [ $pollId ]); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -83,6 +83,6 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function deleteByPollAndUser($pollId, $userId) { |
| 85 | 85 | $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ? AND user_id = ?'; |
| 86 | - $this->execute($sql, [$pollId, $userId]); |
|
| 86 | + $this->execute($sql, [ $pollId, $userId ]); |
|
| 87 | 87 | } |
| 88 | 88 | } |
@@ -35,16 +35,16 @@ |
||
| 35 | 35 | * @method void setType(integer $value) |
| 36 | 36 | */ |
| 37 | 37 | class ParticipationText extends Model { |
| 38 | - protected $text; |
|
| 39 | - protected $userId; |
|
| 40 | - protected $pollId; |
|
| 41 | - protected $type; |
|
| 38 | + protected $text; |
|
| 39 | + protected $userId; |
|
| 40 | + protected $pollId; |
|
| 41 | + protected $type; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * ParticipationText constructor. |
|
| 45 | - */ |
|
| 46 | - public function __construct() { |
|
| 47 | - $this->addType('pollId', 'integer'); |
|
| 48 | - $this->addType('type', 'integer'); |
|
| 49 | - } |
|
| 43 | + /** |
|
| 44 | + * ParticipationText constructor. |
|
| 45 | + */ |
|
| 46 | + public function __construct() { |
|
| 47 | + $this->addType('pollId', 'integer'); |
|
| 48 | + $this->addType('type', 'integer'); |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -28,57 +28,57 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | class EventMapper extends Mapper { |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * EventMapper constructor. |
|
| 33 | - * @param IDBConnection $db |
|
| 34 | - */ |
|
| 35 | - public function __construct(IDBConnection $db) { |
|
| 36 | - parent::__construct($db, 'polls_events', '\OCA\Polls\Db\Event'); |
|
| 37 | - } |
|
| 31 | + /** |
|
| 32 | + * EventMapper constructor. |
|
| 33 | + * @param IDBConnection $db |
|
| 34 | + */ |
|
| 35 | + public function __construct(IDBConnection $db) { |
|
| 36 | + parent::__construct($db, 'polls_events', '\OCA\Polls\Db\Event'); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param int $id |
|
| 41 | - * @throws \OCP\AppFramework\Db\DoesNotExistException if not found |
|
| 42 | - * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result |
|
| 43 | - * @return Event |
|
| 44 | - */ |
|
| 45 | - public function find($id) { |
|
| 46 | - $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE id = ?'; |
|
| 47 | - return $this->findEntity($sql, [$id]); |
|
| 48 | - } |
|
| 39 | + /** |
|
| 40 | + * @param int $id |
|
| 41 | + * @throws \OCP\AppFramework\Db\DoesNotExistException if not found |
|
| 42 | + * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result |
|
| 43 | + * @return Event |
|
| 44 | + */ |
|
| 45 | + public function find($id) { |
|
| 46 | + $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE id = ?'; |
|
| 47 | + return $this->findEntity($sql, [$id]); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @param string $hash |
|
| 52 | - * @param int $limit |
|
| 53 | - * @param int $offset |
|
| 54 | - * @throws \OCP\AppFramework\Db\DoesNotExistException if not found |
|
| 55 | - * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result |
|
| 56 | - * @return Event |
|
| 57 | - */ |
|
| 58 | - public function findByHash($hash, $limit = null, $offset = null) { |
|
| 59 | - $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE hash = ?'; |
|
| 60 | - return $this->findEntity($sql, [$hash], $limit, $offset); |
|
| 61 | - } |
|
| 50 | + /** |
|
| 51 | + * @param string $hash |
|
| 52 | + * @param int $limit |
|
| 53 | + * @param int $offset |
|
| 54 | + * @throws \OCP\AppFramework\Db\DoesNotExistException if not found |
|
| 55 | + * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result |
|
| 56 | + * @return Event |
|
| 57 | + */ |
|
| 58 | + public function findByHash($hash, $limit = null, $offset = null) { |
|
| 59 | + $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE hash = ?'; |
|
| 60 | + return $this->findEntity($sql, [$hash], $limit, $offset); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * @param string $userId |
|
| 65 | - * @param int $limit |
|
| 66 | - * @param int $offset |
|
| 67 | - * @return Event[] |
|
| 68 | - */ |
|
| 69 | - public function findAllForUser($userId, $limit = null, $offset = null) { |
|
| 70 | - $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE owner = ?'; |
|
| 71 | - return $this->findEntities($sql, [$userId], $limit, $offset); |
|
| 72 | - } |
|
| 63 | + /** |
|
| 64 | + * @param string $userId |
|
| 65 | + * @param int $limit |
|
| 66 | + * @param int $offset |
|
| 67 | + * @return Event[] |
|
| 68 | + */ |
|
| 69 | + public function findAllForUser($userId, $limit = null, $offset = null) { |
|
| 70 | + $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE owner = ?'; |
|
| 71 | + return $this->findEntities($sql, [$userId], $limit, $offset); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * @param string $userId |
|
| 76 | - * @param int $limit |
|
| 77 | - * @param int $offset |
|
| 78 | - * @return Event[] |
|
| 79 | - */ |
|
| 80 | - public function findAllForUserWithInfo($userId, $limit = null, $offset = null) { |
|
| 81 | - $sql = 'SELECT DISTINCT *PREFIX*polls_events.id, |
|
| 74 | + /** |
|
| 75 | + * @param string $userId |
|
| 76 | + * @param int $limit |
|
| 77 | + * @param int $offset |
|
| 78 | + * @return Event[] |
|
| 79 | + */ |
|
| 80 | + public function findAllForUserWithInfo($userId, $limit = null, $offset = null) { |
|
| 81 | + $sql = 'SELECT DISTINCT *PREFIX*polls_events.id, |
|
| 82 | 82 | *PREFIX*polls_events.hash, |
| 83 | 83 | *PREFIX*polls_events.type, |
| 84 | 84 | *PREFIX*polls_events.title, |
@@ -103,6 +103,6 @@ discard block |
||
| 103 | 103 | OR |
| 104 | 104 | *PREFIX*polls_comments.user_id = ? |
| 105 | 105 | ORDER BY created'; |
| 106 | - return $this->findEntities($sql, ['hidden', $userId, 'hidden', $userId, $userId], $limit, $offset); |
|
| 107 | - } |
|
| 106 | + return $this->findEntities($sql, ['hidden', $userId, 'hidden', $userId, $userId], $limit, $offset); |
|
| 107 | + } |
|
| 108 | 108 | } |
@@ -28,61 +28,61 @@ |
||
| 28 | 28 | |
| 29 | 29 | class ParticipationMapper extends Mapper { |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * ParticipationMapper constructor. |
|
| 33 | - * @param IDBConnection $db |
|
| 34 | - */ |
|
| 35 | - public function __construct(IDBConnection $db) { |
|
| 36 | - parent::__construct($db, 'polls_particip', '\OCA\Polls\Db\Participation'); |
|
| 37 | - } |
|
| 31 | + /** |
|
| 32 | + * ParticipationMapper constructor. |
|
| 33 | + * @param IDBConnection $db |
|
| 34 | + */ |
|
| 35 | + public function __construct(IDBConnection $db) { |
|
| 36 | + parent::__construct($db, 'polls_particip', '\OCA\Polls\Db\Participation'); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param string $userId |
|
| 41 | - * @param int $limit |
|
| 42 | - * @param int $offset |
|
| 43 | - * @return Participation[] |
|
| 44 | - */ |
|
| 45 | - public function findDistinctByUser($userId, $limit = null, $offset = null) { |
|
| 46 | - $sql = 'SELECT DISTINCT * FROM ' . $this->getTableName() . ' WHERE user_id = ?'; |
|
| 47 | - return $this->findEntities($sql, [$userId], $limit, $offset); |
|
| 48 | - } |
|
| 39 | + /** |
|
| 40 | + * @param string $userId |
|
| 41 | + * @param int $limit |
|
| 42 | + * @param int $offset |
|
| 43 | + * @return Participation[] |
|
| 44 | + */ |
|
| 45 | + public function findDistinctByUser($userId, $limit = null, $offset = null) { |
|
| 46 | + $sql = 'SELECT DISTINCT * FROM ' . $this->getTableName() . ' WHERE user_id = ?'; |
|
| 47 | + return $this->findEntities($sql, [$userId], $limit, $offset); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @param int $pollId |
|
| 52 | - * @param int $limit |
|
| 53 | - * @param int $offset |
|
| 54 | - * @return Participation[] |
|
| 55 | - */ |
|
| 56 | - public function findByPoll($pollId, $limit = null, $offset = null) { |
|
| 57 | - $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
| 58 | - return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
| 59 | - } |
|
| 50 | + /** |
|
| 51 | + * @param int $pollId |
|
| 52 | + * @param int $limit |
|
| 53 | + * @param int $offset |
|
| 54 | + * @return Participation[] |
|
| 55 | + */ |
|
| 56 | + public function findByPoll($pollId, $limit = null, $offset = null) { |
|
| 57 | + $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
| 58 | + return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * @param int $pollId |
|
| 63 | - * @param int $limit |
|
| 64 | - * @param int $offset |
|
| 65 | - * @return Participation[] |
|
| 66 | - */ |
|
| 67 | - public function findParticipantsByPoll($pollId, $limit = null, $offset = null) { |
|
| 68 | - $sql = 'SELECT DISTINCT user_id FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
| 69 | - return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
| 70 | - } |
|
| 61 | + /** |
|
| 62 | + * @param int $pollId |
|
| 63 | + * @param int $limit |
|
| 64 | + * @param int $offset |
|
| 65 | + * @return Participation[] |
|
| 66 | + */ |
|
| 67 | + public function findParticipantsByPoll($pollId, $limit = null, $offset = null) { |
|
| 68 | + $sql = 'SELECT DISTINCT user_id FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
| 69 | + return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * @param int $pollId |
|
| 74 | - */ |
|
| 75 | - public function deleteByPoll($pollId) { |
|
| 76 | - $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
| 77 | - $this->execute($sql, [$pollId]); |
|
| 78 | - } |
|
| 72 | + /** |
|
| 73 | + * @param int $pollId |
|
| 74 | + */ |
|
| 75 | + public function deleteByPoll($pollId) { |
|
| 76 | + $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
| 77 | + $this->execute($sql, [$pollId]); |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * @param int $pollId |
|
| 82 | - * @param string $userId |
|
| 83 | - */ |
|
| 84 | - public function deleteByPollAndUser($pollId, $userId) { |
|
| 85 | - $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ? AND user_id = ?'; |
|
| 86 | - $this->execute($sql, [$pollId, $userId]); |
|
| 87 | - } |
|
| 80 | + /** |
|
| 81 | + * @param int $pollId |
|
| 82 | + * @param string $userId |
|
| 83 | + */ |
|
| 84 | + public function deleteByPollAndUser($pollId, $userId) { |
|
| 85 | + $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ? AND user_id = ?'; |
|
| 86 | + $this->execute($sql, [$pollId, $userId]); |
|
| 87 | + } |
|
| 88 | 88 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function findDistinctByUser($userId, $limit = null, $offset = null) { |
| 46 | 46 | $sql = 'SELECT DISTINCT * FROM ' . $this->getTableName() . ' WHERE user_id = ?'; |
| 47 | - return $this->findEntities($sql, [$userId], $limit, $offset); |
|
| 47 | + return $this->findEntities($sql, [ $userId ], $limit, $offset); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function findByPoll($pollId, $limit = null, $offset = null) { |
| 57 | 57 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
| 58 | - return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
| 58 | + return $this->findEntities($sql, [ $pollId ], $limit, $offset); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function findParticipantsByPoll($pollId, $limit = null, $offset = null) { |
| 68 | 68 | $sql = 'SELECT DISTINCT user_id FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
| 69 | - return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
| 69 | + return $this->findEntities($sql, [ $pollId ], $limit, $offset); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function deleteByPoll($pollId) { |
| 76 | 76 | $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
| 77 | - $this->execute($sql, [$pollId]); |
|
| 77 | + $this->execute($sql, [ $pollId ]); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -83,6 +83,6 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function deleteByPollAndUser($pollId, $userId) { |
| 85 | 85 | $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ? AND user_id = ?'; |
| 86 | - $this->execute($sql, [$pollId, $userId]); |
|
| 86 | + $this->execute($sql, [ $pollId, $userId ]); |
|
| 87 | 87 | } |
| 88 | 88 | } |
@@ -28,30 +28,30 @@ |
||
| 28 | 28 | |
| 29 | 29 | class DateMapper extends Mapper { |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * DateMapper constructor. |
|
| 33 | - * @param IDBConnection $db |
|
| 34 | - */ |
|
| 35 | - public function __construct(IDBConnection $db) { |
|
| 36 | - parent::__construct($db, 'polls_dts', '\OCA\Polls\Db\Date'); |
|
| 37 | - } |
|
| 31 | + /** |
|
| 32 | + * DateMapper constructor. |
|
| 33 | + * @param IDBConnection $db |
|
| 34 | + */ |
|
| 35 | + public function __construct(IDBConnection $db) { |
|
| 36 | + parent::__construct($db, 'polls_dts', '\OCA\Polls\Db\Date'); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param int $pollId |
|
| 41 | - * @param int $limit |
|
| 42 | - * @param int $offset |
|
| 43 | - * @return Date[] |
|
| 44 | - */ |
|
| 45 | - public function findByPoll($pollId, $limit = null, $offset = null) { |
|
| 46 | - $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
| 47 | - return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
| 48 | - } |
|
| 39 | + /** |
|
| 40 | + * @param int $pollId |
|
| 41 | + * @param int $limit |
|
| 42 | + * @param int $offset |
|
| 43 | + * @return Date[] |
|
| 44 | + */ |
|
| 45 | + public function findByPoll($pollId, $limit = null, $offset = null) { |
|
| 46 | + $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
| 47 | + return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @param int $pollId |
|
| 52 | - */ |
|
| 53 | - public function deleteByPoll($pollId) { |
|
| 54 | - $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
| 55 | - $this->execute($sql, [$pollId]); |
|
| 56 | - } |
|
| 50 | + /** |
|
| 51 | + * @param int $pollId |
|
| 52 | + */ |
|
| 53 | + public function deleteByPoll($pollId) { |
|
| 54 | + $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
| 55 | + $this->execute($sql, [$pollId]); |
|
| 56 | + } |
|
| 57 | 57 | } |