| @@ 108-125 (lines=18) @@ | ||
| 105 | /** |
|
| 106 | * {@inheritdoc} |
|
| 107 | */ |
|
| 108 | public function loadUserBookmarks(int $userId, int $offset = 0, int $limit = -1): array |
|
| 109 | { |
|
| 110 | $query = $this->connection->createQueryBuilder(); |
|
| 111 | $query |
|
| 112 | ->select(...$this->getColumns()) |
|
| 113 | ->from(self::TABLE_BOOKMARKS) |
|
| 114 | ->where($query->expr()->eq(self::COLUMN_USER_ID, ':user_id')) |
|
| 115 | ->setFirstResult($offset); |
|
| 116 | ||
| 117 | if ($limit > 0) { |
|
| 118 | $query->setMaxResults($limit); |
|
| 119 | } |
|
| 120 | ||
| 121 | $query->orderBy(self::COLUMN_ID, 'DESC'); |
|
| 122 | $query->setParameter(':user_id', $userId, PDO::PARAM_INT); |
|
| 123 | ||
| 124 | return $query->execute()->fetchAll(PDO::FETCH_ASSOC); |
|
| 125 | } |
|
| 126 | ||
| 127 | /** |
|
| 128 | * {@inheritdoc} |
|
| @@ 136-153 (lines=18) @@ | ||
| 133 | /** |
|
| 134 | * {@inheritdoc} |
|
| 135 | */ |
|
| 136 | public function loadUserNotifications(int $userId, int $offset = 0, int $limit = -1): array |
|
| 137 | { |
|
| 138 | $query = $this->connection->createQueryBuilder(); |
|
| 139 | $query |
|
| 140 | ->select(...$this->getColumns()) |
|
| 141 | ->from(self::TABLE_NOTIFICATION) |
|
| 142 | ->where($query->expr()->eq(self::COLUMN_OWNER_ID, ':user_id')) |
|
| 143 | ->setFirstResult($offset); |
|
| 144 | ||
| 145 | if ($limit > 0) { |
|
| 146 | $query->setMaxResults($limit); |
|
| 147 | } |
|
| 148 | ||
| 149 | $query->orderBy(self::COLUMN_ID, 'DESC'); |
|
| 150 | $query->setParameter(':user_id', $userId, PDO::PARAM_INT); |
|
| 151 | ||
| 152 | return $query->execute()->fetchAll(PDO::FETCH_ASSOC); |
|
| 153 | } |
|
| 154 | ||
| 155 | /** |
|
| 156 | * {@inheritdoc} |
|
| @@ 95-112 (lines=18) @@ | ||
| 92 | /** |
|
| 93 | * {@inheritdoc} |
|
| 94 | */ |
|
| 95 | public function loadUserPreferences(int $userId, int $offset = 0, int $limit = -1): array |
|
| 96 | { |
|
| 97 | $query = $this->connection->createQueryBuilder(); |
|
| 98 | $query |
|
| 99 | ->select(...$this->getColumns()) |
|
| 100 | ->from(self::TABLE_USER_PREFERENCES) |
|
| 101 | ->where($query->expr()->eq(self::COLUMN_USER_ID, ':user_id')) |
|
| 102 | ->setFirstResult($offset); |
|
| 103 | ||
| 104 | if ($limit > 0) { |
|
| 105 | $query->setMaxResults($limit); |
|
| 106 | } |
|
| 107 | ||
| 108 | $query->orderBy(self::COLUMN_ID, 'ASC'); |
|
| 109 | $query->setParameter(':user_id', $userId, ParameterType::INTEGER); |
|
| 110 | ||
| 111 | return $query->execute()->fetchAll(FetchMode::ASSOCIATIVE); |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * {@inheritdoc} |
|