| 1 | <?php |
| 2 | |
| 3 | require_once __DIR__ . "/NOT_FOUND.php"; |
| 4 | require_once __DIR__ . "/ProblemDetailsException.php"; |
| 5 | |
| 6 | function validaEntidadObligatoria(string $nombre, $entidad) |
| 7 | { |
| 8 | |
| 9 | if ($entidad === false) |
| 10 | throw new ProblemDetailsException([ |
| 11 | "status" => NOT_FOUND, |
| 12 | "title" => "Registro de $nombre no encontrado.", |
| 13 | "type" => "/errors/entidadnoencontrada.html", |
| 14 | "detail" => "No se encontró ningún registro de $nombre con el id solicitado.", |
| 15 | ]); |
| 16 | |
| 17 | return $entidad; |
| 18 | } |
| 19 |