| @@ 159-178 (lines=20) @@ | ||
| 156 | * |
|
| 157 | * @throws RecordNotFoundException |
|
| 158 | */ |
|
| 159 | public function getLatestUserFieldNote($userId) |
|
| 160 | { |
|
| 161 | $queryBuilder = $this->connection->createQueryBuilder() |
|
| 162 | ->select('*') |
|
| 163 | ->from(self::TABLE) |
|
| 164 | ->where('user_id = :userId') |
|
| 165 | ->orderBy('date', 'DESC') |
|
| 166 | ->setParameter('userId', $userId) |
|
| 167 | ->setMaxResults(1); |
|
| 168 | ||
| 169 | $statement = $queryBuilder->execute(); |
|
| 170 | ||
| 171 | $result = $statement->fetch(); |
|
| 172 | ||
| 173 | if ($statement->rowCount() === 0) { |
|
| 174 | throw new RecordNotFoundException('Record with given where clause not found'); |
|
| 175 | } |
|
| 176 | ||
| 177 | return $this->getEntityFromDatabaseArray($result); |
|
| 178 | } |
|
| 179 | ||
| 180 | /** |
|
| 181 | * Creates a field note in the database. |
|
| @@ 150-169 (lines=20) @@ | ||
| 147 | * |
|
| 148 | * @throws RecordNotFoundException |
|
| 149 | */ |
|
| 150 | public function getLatestUserLog($userId) |
|
| 151 | { |
|
| 152 | $queryBuilder = $this->connection->createQueryBuilder() |
|
| 153 | ->select('*') |
|
| 154 | ->from(self::TABLE) |
|
| 155 | ->where('user_id = :userId') |
|
| 156 | ->orderBy('date', 'DESC') |
|
| 157 | ->setParameter('userId', $userId) |
|
| 158 | ->setMaxResults(1); |
|
| 159 | ||
| 160 | $statement = $queryBuilder->execute(); |
|
| 161 | ||
| 162 | $result = $statement->fetch(); |
|
| 163 | ||
| 164 | if ($statement->rowCount() === 0) { |
|
| 165 | throw new RecordNotFoundException('Record with given where clause not found'); |
|
| 166 | } |
|
| 167 | ||
| 168 | return $this->getEntityFromDatabaseArray($result); |
|
| 169 | } |
|
| 170 | ||
| 171 | /** |
|
| 172 | * Creates a GeoCacheLog in the database. |
|