Skip to content

Commit 39e34f7

Browse files
Merge pull request #5 from AutoProtect-Group/NAV-5289
NAV-5289: Adding TTL check to getOneById
2 parents bf51188 + fac1ce6 commit 39e34f7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Repository/DynamoDBRepository.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,15 @@ public function getOneById(
291291
);
292292
}
293293

294-
return $this->hydrator->hydrate($this->marshaler->unmarshalItem($output[0]));
294+
$result = $this->hydrator->hydrate($this->marshaler->unmarshalItem($output[0]));
295+
296+
if ((is_object($result)) && (method_exists($result, 'hasExpired')) && ($result->hasExpired())) {
297+
throw new EntityNotFoundException(
298+
sprintf('%s by ID %s has expired', $this->modelClassName, $id)
299+
);
300+
}
301+
302+
return $result;
295303
}
296304

297305
/**

0 commit comments

Comments
 (0)