diff options
author | Thomas Lange <code@nerdmind.de> | 2021-08-05 18:19:19 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2021-08-05 18:27:08 +0200 |
commit | a0722c6d149b253a320976a64aad6e57ab1cccd7 (patch) | |
tree | 12529b8ffb17043e956b2afe4cb28359f28eec5b /admin/post | |
parent | de51f59ef9a50bce0ef63a883c590d1feeadca5d (diff) | |
download | blog-a0722c6d149b253a320976a64aad6e57ab1cccd7.tar.gz blog-a0722c6d149b253a320976a64aad6e57ab1cccd7.tar.xz blog-a0722c6d149b253a320976a64aad6e57ab1cccd7.zip |
Don't check return value of insert/delete methods
Don't check the return value of the Repository's "insert" and "delete"
methods in the administration controllers for creating and modifying
entities since a PDOException is thrown if an error occurs.
Diffstat (limited to 'admin/post')
-rw-r--r-- | admin/post/delete.php | 5 | ||||
-rw-r--r-- | admin/post/insert.php | 5 |
2 files changed, 4 insertions, 6 deletions
diff --git a/admin/post/delete.php b/admin/post/delete.php index 3fb4c84..501cae4 100644 --- a/admin/post/delete.php +++ b/admin/post/delete.php @@ -28,9 +28,8 @@ if(!$Post = $PostRepository->find(HTTP::GET('id'))) { if(HTTP::issetPOST('delete')) { if(HTTP::issetPOST(['token' => Application::getSecurityToken()])) { try { - if($PostRepository->delete($Post)) { - HTTP::redirect(Application::getAdminURL('post/')); - } + $PostRepository->delete($Post); + HTTP::redirect(Application::getAdminURL('post/')); } catch(PDOException $Exception) { $messages[] = $Exception->getMessage(); } diff --git a/admin/post/insert.php b/admin/post/insert.php index 1a8cac7..1b04ecc 100644 --- a/admin/post/insert.php +++ b/admin/post/insert.php @@ -37,9 +37,8 @@ if(HTTP::issetPOST('insert')) { if(HTTP::issetPOST(['token' => Application::getSecurityToken()])) { try { - if($PostRepository->insert($Post)) { - HTTP::redirect(Application::getAdminURL('post/')); - } + $PostRepository->insert($Post); + HTTP::redirect(Application::getAdminURL('post/')); } catch(PDOException $Exception) { $messages[] = $Exception->getMessage(); } |