From d2631f9a7daafd220a0b162d27e491470cd8c557 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 15 Oct 2017 18:54:27 +0200 Subject: [PATCH] Fix minor bugs for full inspections --- Admin/Uninstall.php | 1 + Admin/Update.php | 4 +++- Models/NewsArticle.php | 8 ++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Admin/Uninstall.php b/Admin/Uninstall.php index 4923eb3..b698175 100644 --- a/Admin/Uninstall.php +++ b/Admin/Uninstall.php @@ -17,6 +17,7 @@ namespace Modules\News\Admin; use phpOMS\DataStorage\Database\DatabasePool; use phpOMS\DataStorage\Database\Schema\Builder; use phpOMS\Module\UninstallAbstract; +use phpOMS\Module\InfoManager; /** * Navigation class. diff --git a/Admin/Update.php b/Admin/Update.php index d54248b..32315ee 100644 --- a/Admin/Update.php +++ b/Admin/Update.php @@ -17,6 +17,8 @@ namespace Modules\News\Admin; use phpOMS\DataStorage\Database\DatabasePool; use phpOMS\Module\UpdateAbstract; use phpOMS\System\File\Directory; +use phpOMS\Module\InfoManager; + /** * Navigation class. @@ -33,7 +35,7 @@ class Update extends UpdateAbstract /** * {@inheritdoc} */ - public static function update(DatabasePool $dbPool, array $info) + public static function update(DatabasePool $dbPool, InfoManager $info) { Directory::deletePath(__DIR__ . '/Update'); mkdir('Update'); diff --git a/Models/NewsArticle.php b/Models/NewsArticle.php index 9c852f6..f3441d9 100644 --- a/Models/NewsArticle.php +++ b/Models/NewsArticle.php @@ -333,7 +333,7 @@ class NewsArticle implements ArrayableInterface, \JsonSerializable public function setType(int $type) { if(!NewsType::isValidValue($type)) { - throw new InvalidEnumValue($type); + throw new InvalidEnumValue((string) $type); } $this->type = $type; @@ -361,7 +361,7 @@ class NewsArticle implements ArrayableInterface, \JsonSerializable public function setStatus(int $status) { if(!NewsStatus::isValidValue($status)) { - throw new InvalidEnumValue($status); + throw new InvalidEnumValue((string) $status); } $this->status = $status; @@ -399,8 +399,8 @@ class NewsArticle implements ArrayableInterface, \JsonSerializable 'type' => $this->type, 'status' => $this->status, 'featured' => $this->featured, - 'publish' => $this->publish, - 'createdAt' => $this->createdAt, + 'publish' => $this->publish->format('Y-m-d H:i:s'), + 'createdAt' => $this->createdAt->format('Y-m-d H:i:s'), 'createdBy' => $this->createdBy, ]; }