| @@ 201-214 (lines=14) @@ | ||
| 198 | return (int)$query->execute()->fetchColumn(); |
|
| 199 | } |
|
| 200 | ||
| 201 | public function deleteSection(int $id): void |
|
| 202 | { |
|
| 203 | $query = $this->connection->createQueryBuilder(); |
|
| 204 | $query |
|
| 205 | ->delete(self::CONTENT_SECTION_TABLE) |
|
| 206 | ->where( |
|
| 207 | $query->expr()->eq( |
|
| 208 | 'id', |
|
| 209 | $query->createPositionalParameter($id, ParameterType::INTEGER) |
|
| 210 | ) |
|
| 211 | ); |
|
| 212 | ||
| 213 | $query->execute(); |
|
| 214 | } |
|
| 215 | ||
| 216 | public function assignSectionToContent(int $sectionId, int $contentId): void |
|
| 217 | { |
|
| @@ 43-57 (lines=15) @@ | ||
| 40 | $this->dbPlatform = $this->connection->getDatabasePlatform(); |
|
| 41 | } |
|
| 42 | ||
| 43 | public function load(int $userId): array |
|
| 44 | { |
|
| 45 | $query = $this->getLoadUserQueryBuilder(); |
|
| 46 | $query |
|
| 47 | ->where( |
|
| 48 | $query->expr()->eq( |
|
| 49 | 'u.contentobject_id', |
|
| 50 | $query->createPositionalParameter($userId, ParameterType::INTEGER) |
|
| 51 | ) |
|
| 52 | ); |
|
| 53 | ||
| 54 | $statement = $query->execute(); |
|
| 55 | ||
| 56 | return $statement->fetchAll(FetchMode::ASSOCIATIVE); |
|
| 57 | } |
|
| 58 | ||
| 59 | public function loadByLogin(string $login): array |
|
| 60 | { |
|
| @@ 59-76 (lines=18) @@ | ||
| 56 | return $statement->fetchAll(FetchMode::ASSOCIATIVE); |
|
| 57 | } |
|
| 58 | ||
| 59 | public function loadByLogin(string $login): array |
|
| 60 | { |
|
| 61 | $query = $this->getLoadUserQueryBuilder(); |
|
| 62 | $expr = $query->expr(); |
|
| 63 | $query |
|
| 64 | ->where( |
|
| 65 | $expr->eq( |
|
| 66 | $this->dbPlatform->getLowerExpression('u.login'), |
|
| 67 | // Index is case in-sensitive, on some db's lowercase, so we lowercase $login |
|
| 68 | $query->createPositionalParameter( |
|
| 69 | mb_strtolower($login, 'UTF-8'), |
|
| 70 | ParameterType::STRING |
|
| 71 | ) |
|
| 72 | ) |
|
| 73 | ); |
|
| 74 | ||
| 75 | return $query->execute()->fetchAll(FetchMode::ASSOCIATIVE); |
|
| 76 | } |
|
| 77 | ||
| 78 | public function loadByEmail(string $email): array |
|
| 79 | { |
|
| @@ 78-91 (lines=14) @@ | ||
| 75 | return $query->execute()->fetchAll(FetchMode::ASSOCIATIVE); |
|
| 76 | } |
|
| 77 | ||
| 78 | public function loadByEmail(string $email): array |
|
| 79 | { |
|
| 80 | $query = $this->getLoadUserQueryBuilder(); |
|
| 81 | $query->where( |
|
| 82 | $query->expr()->eq( |
|
| 83 | 'u.email', |
|
| 84 | $query->createPositionalParameter($email, ParameterType::STRING) |
|
| 85 | ) |
|
| 86 | ); |
|
| 87 | ||
| 88 | $statement = $query->execute(); |
|
| 89 | ||
| 90 | return $statement->fetchAll(FetchMode::ASSOCIATIVE); |
|
| 91 | } |
|
| 92 | ||
| 93 | public function loadUserByToken(string $hash): array |
|
| 94 | { |
|
| @@ 222-234 (lines=13) @@ | ||
| 219 | $query->execute(); |
|
| 220 | } |
|
| 221 | ||
| 222 | public function removeRoleAssignmentById(int $roleAssignmentId): void |
|
| 223 | { |
|
| 224 | $query = $this->connection->createQueryBuilder(); |
|
| 225 | $query |
|
| 226 | ->delete('ezuser_role') |
|
| 227 | ->where( |
|
| 228 | $query->expr()->eq( |
|
| 229 | 'id', |
|
| 230 | $query->createPositionalParameter($roleAssignmentId, ParameterType::INTEGER) |
|
| 231 | ) |
|
| 232 | ); |
|
| 233 | $query->execute(); |
|
| 234 | } |
|
| 235 | ||
| 236 | private function getLoadUserQueryBuilder(): QueryBuilder |
|
| 237 | { |
|