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