From 6076f244c4b4a27b02218cf80191a13cb55bf531 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 4 Feb 2019 22:29:55 +0100 Subject: [PATCH] Use global namespace+minor fixes --- Models/Report.php | 5 ++++- Models/ReportMapper.php | 6 ++++++ Models/Template.php | 19 +++++++++++-------- Models/TemplateMapper.php | 13 ++++++++++++- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/Models/Report.php b/Models/Report.php index 544cf27..5212bc0 100644 --- a/Models/Report.php +++ b/Models/Report.php @@ -216,7 +216,7 @@ class Report implements \JsonSerializable } /** - * @return mixed + * @return int|\phpOMS\Account\Account * * @since 1.0.0 */ @@ -293,6 +293,9 @@ class Report implements \JsonSerializable ]; } + /** + * {@inheritdoc} + */ public function jsonSerialize() { return $this->toArray(); diff --git a/Models/ReportMapper.php b/Models/ReportMapper.php index cebd455..64eecdc 100644 --- a/Models/ReportMapper.php +++ b/Models/ReportMapper.php @@ -55,6 +55,12 @@ final class ReportMapper extends DataMapperAbstract ], ]; + /** + * Belongs to. + * + * @var array> + * @since 1.0.0 + */ protected static $belongsTo = [ 'createdBy' => [ 'mapper' => AccountMapper::class, diff --git a/Models/Template.php b/Models/Template.php index 67880d7..ad03819 100644 --- a/Models/Template.php +++ b/Models/Template.php @@ -251,7 +251,7 @@ class Template implements \JsonSerializable } /** - * @return mixed + * @return int|\phpOMS\Account\Account * * @since 1.0.0 */ @@ -373,17 +373,20 @@ class Template implements \JsonSerializable public function toArray() : array { return [ - 'id' => $this->id, - 'createdBy' => $this->createdBy, - 'createdAt' => $this->createdAt->format('Y-m-d H:i:s'), - 'name' => $this->name, + 'id' => $this->id, + 'createdBy' => $this->createdBy, + 'createdAt' => $this->createdAt->format('Y-m-d H:i:s'), + 'name' => $this->name, 'description' => $this->description, - 'status' => $this->status, - 'datatype' => $this->datatype, - 'standalone' => $this->isStandalone, + 'status' => $this->status, + 'datatype' => $this->datatype, + 'standalone' => $this->isStandalone, ]; } + /** + * {@inheritdoc} + */ public function jsonSerialize() { return $this->toArray(); diff --git a/Models/TemplateMapper.php b/Models/TemplateMapper.php index 76a855f..6f2f824 100644 --- a/Models/TemplateMapper.php +++ b/Models/TemplateMapper.php @@ -56,6 +56,12 @@ final class TemplateMapper extends DataMapperAbstract ], ]; + /** + * Belongs to. + * + * @var array> + * @since 1.0.0 + */ protected static $belongsTo = [ 'createdBy' => [ 'mapper' => AccountMapper::class, @@ -63,7 +69,12 @@ final class TemplateMapper extends DataMapperAbstract ], ]; - + /** + * Has many relation. + * + * @var array> + * @since 1.0.0 + */ protected static $hasMany = [ 'reports' => [ 'mapper' => ReportMapper::class,