I want to check if a record exists inside a database. But how to handle with the RecordNotFoundException that's trowed before the if
statement?
$Content = $this->Content->get($id);
if (!$Content) {
// forward to 404
}
// Go further
I've also tried to use catch but that's giving the same RecordNotFoundException.
try {
$Content = $this->Content->get($id);
} catch (RecordNotFoundException $exception) {
// forward to 404
}