@@ -28,16 +28,16 @@ |
||
28 | 28 | |
29 | 29 | class AppTest extends TestCase { |
30 | 30 | |
31 | - private $container; |
|
31 | + private $container; |
|
32 | 32 | |
33 | - public function setUp() { |
|
34 | - parent::setUp(); |
|
35 | - $app = new App('polls'); |
|
36 | - $this->container = $app->getContainer(); |
|
37 | - } |
|
33 | + public function setUp() { |
|
34 | + parent::setUp(); |
|
35 | + $app = new App('polls'); |
|
36 | + $this->container = $app->getContainer(); |
|
37 | + } |
|
38 | 38 | |
39 | - public function testAppInstalled() { |
|
40 | - $appManager = $this->container->query('OCP\App\IAppManager'); |
|
41 | - $this->assertTrue($appManager->isInstalled('polls')); |
|
42 | - } |
|
39 | + public function testAppInstalled() { |
|
40 | + $appManager = $this->container->query('OCP\App\IAppManager'); |
|
41 | + $this->assertTrue($appManager->isInstalled('polls')); |
|
42 | + } |
|
43 | 43 | } |
@@ -23,17 +23,17 @@ |
||
23 | 23 | |
24 | 24 | $app = new \OCA\Polls\AppInfo\Application(); |
25 | 25 | $app->registerRoutes($this, array( |
26 | - 'routes' => array( |
|
27 | - array('name' => 'page#index', 'url' => '/', 'verb' => 'GET'), |
|
28 | - array('name' => 'page#goto_poll', 'url' => '/poll/{hash}', 'verb' => 'GET'), |
|
29 | - array('name' => 'page#edit_poll', 'url' => '/edit/{hash}', 'verb' => 'GET'), |
|
30 | - array('name' => 'page#create_poll', 'url' => '/create', 'verb' => 'GET'), |
|
31 | - array('name' => 'page#delete_poll', 'url' => '/delete', 'verb' => 'POST'), |
|
32 | - array('name' => 'page#update_poll', 'url' => '/update', 'verb' => 'POST'), |
|
33 | - array('name' => 'page#insert_poll', 'url' => '/insert', 'verb' => 'POST'), |
|
34 | - array('name' => 'page#insert_vote', 'url' => '/insert/vote', 'verb' => 'POST'), |
|
35 | - array('name' => 'page#insert_comment', 'url' => '/insert/comment', 'verb' => 'POST'), |
|
36 | - array('name' => 'page#search', 'url' => '/search', 'verb' => 'POST'), |
|
37 | - array('name' => 'page#get_display_name', 'url' => '/get/displayname', 'verb' => 'POST'), |
|
38 | - ) |
|
26 | + 'routes' => array( |
|
27 | + array('name' => 'page#index', 'url' => '/', 'verb' => 'GET'), |
|
28 | + array('name' => 'page#goto_poll', 'url' => '/poll/{hash}', 'verb' => 'GET'), |
|
29 | + array('name' => 'page#edit_poll', 'url' => '/edit/{hash}', 'verb' => 'GET'), |
|
30 | + array('name' => 'page#create_poll', 'url' => '/create', 'verb' => 'GET'), |
|
31 | + array('name' => 'page#delete_poll', 'url' => '/delete', 'verb' => 'POST'), |
|
32 | + array('name' => 'page#update_poll', 'url' => '/update', 'verb' => 'POST'), |
|
33 | + array('name' => 'page#insert_poll', 'url' => '/insert', 'verb' => 'POST'), |
|
34 | + array('name' => 'page#insert_vote', 'url' => '/insert/vote', 'verb' => 'POST'), |
|
35 | + array('name' => 'page#insert_comment', 'url' => '/insert/comment', 'verb' => 'POST'), |
|
36 | + array('name' => 'page#search', 'url' => '/search', 'verb' => 'POST'), |
|
37 | + array('name' => 'page#get_display_name', 'url' => '/get/displayname', 'verb' => 'POST'), |
|
38 | + ) |
|
39 | 39 | )); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function find($id) { |
42 | 42 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE id = ?'; |
43 | - return $this->findEntity($sql, [$id]); |
|
43 | + return $this->findEntity($sql, [ $id ]); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function findBetween($userId, $from, $until, $limit = null, $offset = null) { |
55 | 55 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE userId = ? AND timestamp BETWEEN ? AND ?'; |
56 | - return $this->findEntities($sql, [$userId, $from, $until], $limit, $offset); |
|
56 | + return $this->findEntities($sql, [ $userId, $from, $until ], $limit, $offset); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function findAll($limit = null, $offset = null) { |
65 | 65 | $sql = 'SELECT * FROM ' . $this->getTableName(); |
66 | - return $this->findEntities($sql, [], $limit, $offset); |
|
66 | + return $this->findEntities($sql, [ ], $limit, $offset); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function findAllByPoll($pollId, $limit = null, $offset = null) { |
76 | 76 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
77 | - return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
77 | + return $this->findEntities($sql, [ $pollId ], $limit, $offset); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -84,6 +84,6 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function findByUserAndPoll($pollId, $userId) { |
86 | 86 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ? AND user_id = ?'; |
87 | - return $this->findEntity($sql, [$pollId, $userId]); |
|
87 | + return $this->findEntity($sql, [ $pollId, $userId ]); |
|
88 | 88 | } |
89 | 89 | } |
@@ -28,64 +28,64 @@ |
||
28 | 28 | |
29 | 29 | class NotificationMapper extends Mapper { |
30 | 30 | |
31 | - public function __construct(IDBConnection $db) { |
|
32 | - parent::__construct($db, 'polls_notif', '\OCA\Polls\Db\Notification'); |
|
33 | - } |
|
31 | + public function __construct(IDBConnection $db) { |
|
32 | + parent::__construct($db, 'polls_notif', '\OCA\Polls\Db\Notification'); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param int $id |
|
37 | - * @throws \OCP\AppFramework\Db\DoesNotExistException if not found |
|
38 | - * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result |
|
39 | - * @return Notification |
|
40 | - */ |
|
41 | - public function find($id) { |
|
42 | - $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE id = ?'; |
|
43 | - return $this->findEntity($sql, [$id]); |
|
44 | - } |
|
35 | + /** |
|
36 | + * @param int $id |
|
37 | + * @throws \OCP\AppFramework\Db\DoesNotExistException if not found |
|
38 | + * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result |
|
39 | + * @return Notification |
|
40 | + */ |
|
41 | + public function find($id) { |
|
42 | + $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE id = ?'; |
|
43 | + return $this->findEntity($sql, [$id]); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * @param string $userId |
|
48 | - * @param string $from |
|
49 | - * @param string $until |
|
50 | - * @param int $limit |
|
51 | - * @param int $offset |
|
52 | - * @return Notification[] |
|
53 | - */ |
|
54 | - public function findBetween($userId, $from, $until, $limit = null, $offset = null) { |
|
55 | - $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE userId = ? AND timestamp BETWEEN ? AND ?'; |
|
56 | - return $this->findEntities($sql, [$userId, $from, $until], $limit, $offset); |
|
57 | - } |
|
46 | + /** |
|
47 | + * @param string $userId |
|
48 | + * @param string $from |
|
49 | + * @param string $until |
|
50 | + * @param int $limit |
|
51 | + * @param int $offset |
|
52 | + * @return Notification[] |
|
53 | + */ |
|
54 | + public function findBetween($userId, $from, $until, $limit = null, $offset = null) { |
|
55 | + $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE userId = ? AND timestamp BETWEEN ? AND ?'; |
|
56 | + return $this->findEntities($sql, [$userId, $from, $until], $limit, $offset); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * @param int $limit |
|
61 | - * @param int $offset |
|
62 | - * @return Notification[] |
|
63 | - */ |
|
64 | - public function findAll($limit = null, $offset = null) { |
|
65 | - $sql = 'SELECT * FROM ' . $this->getTableName(); |
|
66 | - return $this->findEntities($sql, [], $limit, $offset); |
|
67 | - } |
|
59 | + /** |
|
60 | + * @param int $limit |
|
61 | + * @param int $offset |
|
62 | + * @return Notification[] |
|
63 | + */ |
|
64 | + public function findAll($limit = null, $offset = null) { |
|
65 | + $sql = 'SELECT * FROM ' . $this->getTableName(); |
|
66 | + return $this->findEntities($sql, [], $limit, $offset); |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * @param int $pollId |
|
71 | - * @param int $limit |
|
72 | - * @param int $offset |
|
73 | - * @return Notification[] |
|
74 | - */ |
|
75 | - public function findAllByPoll($pollId, $limit = null, $offset = null) { |
|
76 | - $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
77 | - return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
78 | - } |
|
69 | + /** |
|
70 | + * @param int $pollId |
|
71 | + * @param int $limit |
|
72 | + * @param int $offset |
|
73 | + * @return Notification[] |
|
74 | + */ |
|
75 | + public function findAllByPoll($pollId, $limit = null, $offset = null) { |
|
76 | + $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
77 | + return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * @param int $pollId |
|
82 | - * @param string $userId |
|
83 | - * @throws \OCP\AppFramework\Db\DoesNotExistException if not found |
|
84 | - * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result |
|
85 | - * @return Notification |
|
86 | - */ |
|
87 | - public function findByUserAndPoll($pollId, $userId) { |
|
88 | - $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ? AND user_id = ?'; |
|
89 | - return $this->findEntity($sql, [$pollId, $userId]); |
|
90 | - } |
|
80 | + /** |
|
81 | + * @param int $pollId |
|
82 | + * @param string $userId |
|
83 | + * @throws \OCP\AppFramework\Db\DoesNotExistException if not found |
|
84 | + * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result |
|
85 | + * @return Notification |
|
86 | + */ |
|
87 | + public function findByUserAndPoll($pollId, $userId) { |
|
88 | + $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ? AND user_id = ?'; |
|
89 | + return $this->findEntity($sql, [$pollId, $userId]); |
|
90 | + } |
|
91 | 91 | } |
@@ -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 | /** |
@@ -52,6 +52,6 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function deleteByPoll($pollId) { |
54 | 54 | $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
55 | - $this->execute($sql, [$pollId]); |
|
55 | + $this->execute($sql, [ $pollId ]); |
|
56 | 56 | } |
57 | 57 | } |
@@ -28,30 +28,30 @@ |
||
28 | 28 | |
29 | 29 | class TextMapper extends Mapper { |
30 | 30 | |
31 | - /** |
|
32 | - * TextMapper constructor. |
|
33 | - * @param IDBConnection $db |
|
34 | - */ |
|
35 | - public function __construct(IDBConnection $db) { |
|
36 | - parent::__construct($db, 'polls_txts', '\OCA\Polls\Db\Text'); |
|
37 | - } |
|
31 | + /** |
|
32 | + * TextMapper constructor. |
|
33 | + * @param IDBConnection $db |
|
34 | + */ |
|
35 | + public function __construct(IDBConnection $db) { |
|
36 | + parent::__construct($db, 'polls_txts', '\OCA\Polls\Db\Text'); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param int $pollId |
|
41 | - * @param int $limit |
|
42 | - * @param int $offset |
|
43 | - * @return Text[] |
|
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 Text[] |
|
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 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function find($id) { |
46 | 46 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE id = ?'; |
47 | - return $this->findEntity($sql, [$id]); |
|
47 | + return $this->findEntity($sql, [ $id ]); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function findByHash($hash, $limit = null, $offset = null) { |
57 | 57 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE hash = ?'; |
58 | - return $this->findEntity($sql, [$hash], $limit, $offset); |
|
58 | + return $this->findEntity($sql, [ $hash ], $limit, $offset); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function findAllForUser($userId, $limit = null, $offset = null) { |
68 | 68 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE owner = ?'; |
69 | - return $this->findEntities($sql, [$userId], $limit, $offset); |
|
69 | + return $this->findEntities($sql, [ $userId ], $limit, $offset); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -101,6 +101,6 @@ discard block |
||
101 | 101 | OR |
102 | 102 | *PREFIX*polls_comments.user_id = ? |
103 | 103 | ORDER BY created'; |
104 | - return $this->findEntities($sql, ['hidden', $userId, 'hidden', $userId, $userId], $limit, $offset); |
|
104 | + return $this->findEntities($sql, [ 'hidden', $userId, 'hidden', $userId, $userId ], $limit, $offset); |
|
105 | 105 | } |
106 | 106 | } |
@@ -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 | } |
@@ -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 = ? ORDER BY Dt DESC'; |
58 | - return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
58 | + return $this->findEntities($sql, [ $pollId ], $limit, $offset); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -63,6 +63,6 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function deleteByPoll($pollId) { |
65 | 65 | $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
66 | - $this->execute($sql, [$pollId]); |
|
66 | + $this->execute($sql, [ $pollId ]); |
|
67 | 67 | } |
68 | 68 | } |
@@ -28,41 +28,41 @@ |
||
28 | 28 | |
29 | 29 | class CommentMapper extends Mapper { |
30 | 30 | |
31 | - /** |
|
32 | - * CommentMapper constructor. |
|
33 | - * @param IDBConnection $db |
|
34 | - */ |
|
35 | - public function __construct(IDBConnection $db) { |
|
36 | - parent::__construct($db, 'polls_comments', '\OCA\Polls\Db\Comment'); |
|
37 | - } |
|
31 | + /** |
|
32 | + * CommentMapper constructor. |
|
33 | + * @param IDBConnection $db |
|
34 | + */ |
|
35 | + public function __construct(IDBConnection $db) { |
|
36 | + parent::__construct($db, 'polls_comments', '\OCA\Polls\Db\Comment'); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param string $userId |
|
41 | - * @param int $limit |
|
42 | - * @param int $offset |
|
43 | - * @return Comment[] |
|
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 Comment[] |
|
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 Comment[] |
|
55 | - */ |
|
56 | - public function findByPoll($pollId, $limit = null, $offset = null) { |
|
57 | - $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ? ORDER BY Dt DESC'; |
|
58 | - return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
59 | - } |
|
50 | + /** |
|
51 | + * @param int $pollId |
|
52 | + * @param int $limit |
|
53 | + * @param int $offset |
|
54 | + * @return Comment[] |
|
55 | + */ |
|
56 | + public function findByPoll($pollId, $limit = null, $offset = null) { |
|
57 | + $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ? ORDER BY Dt DESC'; |
|
58 | + return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @param int $pollId |
|
63 | - */ |
|
64 | - public function deleteByPoll($pollId) { |
|
65 | - $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
66 | - $this->execute($sql, [$pollId]); |
|
67 | - } |
|
61 | + /** |
|
62 | + * @param int $pollId |
|
63 | + */ |
|
64 | + public function deleteByPoll($pollId) { |
|
65 | + $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
|
66 | + $this->execute($sql, [$pollId]); |
|
67 | + } |
|
68 | 68 | } |
@@ -1,27 +1,27 @@ |
||
1 | 1 | <?php |
2 | - /** |
|
3 | - * @copyright Copyright (c) 2017 Vinzenz Rosenkranz <[email protected]> |
|
4 | - * |
|
5 | - * @author Vinzenz Rosenkranz <[email protected]> |
|
6 | - * |
|
7 | - * @license GNU AGPL version 3 or any later version |
|
8 | - * |
|
9 | - * This program is free software: you can redistribute it and/or modify |
|
10 | - * it under the terms of the GNU Affero General Public License as |
|
11 | - * published by the Free Software Foundation, either version 3 of the |
|
12 | - * License, or (at your option) any later version. |
|
13 | - * |
|
14 | - * This program is distributed in the hope that it will be useful, |
|
15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17 | - * GNU Affero General Public License for more details. |
|
18 | - * |
|
19 | - * You should have received a copy of the GNU Affero General Public License |
|
20 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
21 | - * |
|
22 | - */ |
|
2 | + /** |
|
3 | + * @copyright Copyright (c) 2017 Vinzenz Rosenkranz <[email protected]> |
|
4 | + * |
|
5 | + * @author Vinzenz Rosenkranz <[email protected]> |
|
6 | + * |
|
7 | + * @license GNU AGPL version 3 or any later version |
|
8 | + * |
|
9 | + * This program is free software: you can redistribute it and/or modify |
|
10 | + * it under the terms of the GNU Affero General Public License as |
|
11 | + * published by the Free Software Foundation, either version 3 of the |
|
12 | + * License, or (at your option) any later version. |
|
13 | + * |
|
14 | + * This program is distributed in the hope that it will be useful, |
|
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17 | + * GNU Affero General Public License for more details. |
|
18 | + * |
|
19 | + * You should have received a copy of the GNU Affero General Public License |
|
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
21 | + * |
|
22 | + */ |
|
23 | 23 | |
24 | - \OCP\Util::addStyle('polls', 'main'); |
|
24 | + \OCP\Util::addStyle('polls', 'main'); |
|
25 | 25 | ?> |
26 | 26 | <div id="app"> |
27 | 27 | <div id="app-content"> |
@@ -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 | /** |
@@ -52,6 +52,6 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function deleteByPoll($pollId) { |
54 | 54 | $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
55 | - $this->execute($sql, [$pollId]); |
|
55 | + $this->execute($sql, [ $pollId ]); |
|
56 | 56 | } |
57 | 57 | } |
@@ -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 | } |
@@ -34,6 +34,6 @@ |
||
34 | 34 | * @param $value |
35 | 35 | */ |
36 | 36 | public function __set($name, $value) { |
37 | - $this->setter($name, [$value]); |
|
37 | + $this->setter($name, [ $value ]); |
|
38 | 38 | } |
39 | 39 | } |
@@ -26,14 +26,14 @@ |
||
26 | 26 | use OCP\AppFramework\Db\Entity; |
27 | 27 | |
28 | 28 | abstract class Model extends Entity { |
29 | - /** |
|
30 | - * FactoryMuffin checks for the existence of setters with method_exists($obj, $attr) but that returns false. |
|
31 | - * By overwriting the __set() magic method we can trigger the changed flag on $obj->attr assignment. |
|
32 | - * |
|
33 | - * @param $name |
|
34 | - * @param $value |
|
35 | - */ |
|
36 | - public function __set($name, $value) { |
|
37 | - $this->setter($name, [$value]); |
|
38 | - } |
|
29 | + /** |
|
30 | + * FactoryMuffin checks for the existence of setters with method_exists($obj, $attr) but that returns false. |
|
31 | + * By overwriting the __set() magic method we can trigger the changed flag on $obj->attr assignment. |
|
32 | + * |
|
33 | + * @param $name |
|
34 | + * @param $value |
|
35 | + */ |
|
36 | + public function __set($name, $value) { |
|
37 | + $this->setter($name, [$value]); |
|
38 | + } |
|
39 | 39 | } |