implement app assoc.

This commit is contained in:
Dennis Eichhorn 2020-02-23 22:58:09 +01:00
parent d5479d4396
commit c87f2af15e
4 changed files with 124 additions and 3 deletions

View File

@ -58,6 +58,13 @@
"foreignTable": "account", "foreignTable": "account",
"foreignKey": "account_id" "foreignKey": "account_id"
}, },
"helper_template_unit": {
"name": "helper_template_unit",
"type": "INT",
"null": true,
"foreignTable": "organization_unit",
"foreignKey": "organization_unit_id"
},
"helper_template_created": { "helper_template_created": {
"name": "helper_template_created", "name": "helper_template_created",
"type": "DATETIME", "type": "DATETIME",

View File

@ -107,6 +107,8 @@ class Report implements \JsonSerializable
} }
/** /**
* Get model id.
*
* @return int * @return int
* *
* @since 1.0.0 * @since 1.0.0
@ -117,6 +119,8 @@ class Report implements \JsonSerializable
} }
/** /**
* Get the activity status
*
* @return int * @return int
* *
* @since 1.0.0 * @since 1.0.0
@ -127,6 +131,8 @@ class Report implements \JsonSerializable
} }
/** /**
* Set the activity status
*
* @param int $status Report status * @param int $status Report status
* *
* @return void * @return void
@ -139,6 +145,8 @@ class Report implements \JsonSerializable
} }
/** /**
* Get title,
*
* @return string * @return string
* *
* @since 1.0.0 * @since 1.0.0
@ -149,6 +157,8 @@ class Report implements \JsonSerializable
} }
/** /**
* Set the title
*
* @param string $title Title * @param string $title Title
* *
* @return void * @return void
@ -161,6 +171,8 @@ class Report implements \JsonSerializable
} }
/** /**
* Get description
*
* @return string * @return string
* *
* @since 1.0.0 * @since 1.0.0
@ -171,6 +183,8 @@ class Report implements \JsonSerializable
} }
/** /**
* Set the description
*
* @param string $description Description * @param string $description Description
* *
* @return void * @return void
@ -183,6 +197,8 @@ class Report implements \JsonSerializable
} }
/** /**
* Get raw description
*
* @return string * @return string
* *
* @since 1.0.0 * @since 1.0.0
@ -193,6 +209,8 @@ class Report implements \JsonSerializable
} }
/** /**
* Set raw description
*
* @param string $descriptionRaw Description * @param string $descriptionRaw Description
* *
* @return void * @return void
@ -205,6 +223,8 @@ class Report implements \JsonSerializable
} }
/** /**
* Get created datetime
*
* @return \DateTime * @return \DateTime
* *
* @since 1.0.0 * @since 1.0.0
@ -215,6 +235,8 @@ class Report implements \JsonSerializable
} }
/** /**
* Get creator
*
* @return int|\phpOMS\Account\Account * @return int|\phpOMS\Account\Account
* *
* @since 1.0.0 * @since 1.0.0
@ -225,6 +247,8 @@ class Report implements \JsonSerializable
} }
/** /**
* Set creator
*
* @param mixed $creator Created by * @param mixed $creator Created by
* *
* @return void * @return void
@ -237,6 +261,8 @@ class Report implements \JsonSerializable
} }
/** /**
* Get template this report belongs to
*
* @return mixed * @return mixed
* *
* @since 1.0.0 * @since 1.0.0
@ -247,6 +273,8 @@ class Report implements \JsonSerializable
} }
/** /**
* Set template this report belongs to
*
* @param mixed $template Report template * @param mixed $template Report template
* *
* @return void * @return void
@ -259,6 +287,8 @@ class Report implements \JsonSerializable
} }
/** /**
* Set source media for the report
*
* @param \Modules\Media\Models\Collection|int $source Report source * @param \Modules\Media\Models\Collection|int $source Report source
* *
* @return void * @return void
@ -271,6 +301,8 @@ class Report implements \JsonSerializable
} }
/** /**
* Get source media for the report
*
* @return \Modules\Media\Models\Collection|int * @return \Modules\Media\Models\Collection|int
* *
* @since 1.0.0 * @since 1.0.0
@ -281,9 +313,7 @@ class Report implements \JsonSerializable
} }
/** /**
* @return array * {@inheritdoc}
*
* @since 1.0.0
*/ */
public function toArray() : array public function toArray() : array
{ {

View File

@ -32,6 +32,14 @@ class Template implements \JsonSerializable
*/ */
private int $id = 0; private int $id = 0;
/**
* Unit.
*
* @var null|int|\Modules\Organization\Models\Unit
* @since 1.0.0
*/
private $unit = null;
/** /**
* Template status. * Template status.
* *
@ -131,6 +139,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Get model id
*
* @return int * @return int
* *
* @since 1.0.0 * @since 1.0.0
@ -140,6 +150,34 @@ class Template implements \JsonSerializable
return $this->id; return $this->id;
} }
/**
* Get unit this template belogns to
*
* @return null|int|\Modules\Organization\Models\Unit
*
* @since 1.0.0
*/
public function getUnit()
{
return $this->unit;
}
/**
* Set unit this model belongs to
*
* Set the unit
*
* @param int $unit Unit
*
* @return void
*
* @since 1.0.0
*/
public function setUnit(int $unit) : void
{
$this->unit = $unit;
}
/** /**
* Get newest report for template. * Get newest report for template.
* *
@ -157,6 +195,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Set template name
*
* @param string $name Template name * @param string $name Template name
* *
* @return void * @return void
@ -169,6 +209,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Get template name
*
* @return string * @return string
* *
* @since 1.0.0 * @since 1.0.0
@ -179,6 +221,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Set description
*
* @param string $description Template description * @param string $description Template description
* *
* @return void * @return void
@ -191,6 +235,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Get description
*
* @return string * @return string
* *
* @since 1.0.0 * @since 1.0.0
@ -201,6 +247,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Set raw description
*
* @param string $description Template description * @param string $description Template description
* *
* @return void * @return void
@ -213,6 +261,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Get raw description
*
* @return string * @return string
* *
* @since 1.0.0 * @since 1.0.0
@ -223,6 +273,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Set source media
*
* @param int $source Source * @param int $source Source
* *
* @return mixed * @return mixed
@ -235,6 +287,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Get source media
*
* @return mixed * @return mixed
* *
* @since 1.0.0 * @since 1.0.0
@ -245,6 +299,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Set creator
*
* @param mixed $createdBy Creator * @param mixed $createdBy Creator
* *
* @return void * @return void
@ -257,6 +313,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Get creator
*
* @return int|\phpOMS\Account\Account * @return int|\phpOMS\Account\Account
* *
* @since 1.0.0 * @since 1.0.0
@ -267,6 +325,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Get created date
*
* @return \DateTime * @return \DateTime
* *
* @since 1.0.0 * @since 1.0.0
@ -277,6 +337,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Set expected files from reports
*
* @param array $expected Expected files * @param array $expected Expected files
* *
* @return void * @return void
@ -289,6 +351,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Get expected files from report
*
* @return array * @return array
* *
* @since 1.0.0 * @since 1.0.0
@ -299,6 +363,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Add expected file from report
*
* @param string $expected Expected file * @param string $expected Expected file
* *
* @return void * @return void
@ -311,6 +377,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Set activity satuus
*
* @param int $status Template status (is active?) * @param int $status Template status (is active?)
* *
* @return void * @return void
@ -323,6 +391,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Get activity status
*
* @return int * @return int
* *
* @since 1.0.0 * @since 1.0.0
@ -333,6 +403,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Set data type basis
*
* @param int $datatype Template datatype source * @param int $datatype Template datatype source
* *
* @return void * @return void
@ -345,6 +417,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Get data type basis
*
* @return int * @return int
* *
* @since 1.0.0 * @since 1.0.0
@ -355,6 +429,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Set if the template needs report data
*
* @param bool $isStandalone Is template standalone * @param bool $isStandalone Is template standalone
* *
* @return void * @return void
@ -367,6 +443,8 @@ class Template implements \JsonSerializable
} }
/** /**
* Does the template need report data?
*
* @return bool * @return bool
* *
* @since 1.0.0 * @since 1.0.0

View File

@ -16,6 +16,7 @@ namespace Modules\Helper\Models;
use Modules\Admin\Models\AccountMapper; use Modules\Admin\Models\AccountMapper;
use Modules\Media\Models\CollectionMapper; use Modules\Media\Models\CollectionMapper;
use Modules\Organization\Models\UnitMapper;
use phpOMS\DataStorage\Database\DataMapperAbstract; use phpOMS\DataStorage\Database\DataMapperAbstract;
/** /**
@ -45,6 +46,7 @@ final class TemplateMapper extends DataMapperAbstract
'helper_template_desc_raw' => ['name' => 'helper_template_desc_raw', 'type' => 'string', 'internal' => 'descriptionRaw'], 'helper_template_desc_raw' => ['name' => 'helper_template_desc_raw', 'type' => 'string', 'internal' => 'descriptionRaw'],
'helper_template_media' => ['name' => 'helper_template_media', 'type' => 'int', 'internal' => 'source'], 'helper_template_media' => ['name' => 'helper_template_media', 'type' => 'int', 'internal' => 'source'],
'helper_template_creator' => ['name' => 'helper_template_creator', 'type' => 'int', 'internal' => 'createdBy', ], 'helper_template_creator' => ['name' => 'helper_template_creator', 'type' => 'int', 'internal' => 'createdBy', ],
'helper_template_unit' => ['name' => 'helper_template_unit', 'type' => 'int', 'internal' => 'unit', ],
'helper_template_created' => ['name' => 'helper_template_created', 'type' => 'DateTime', 'internal' => 'createdAt', ], 'helper_template_created' => ['name' => 'helper_template_created', 'type' => 'DateTime', 'internal' => 'createdAt', ],
]; ];
@ -72,6 +74,10 @@ final class TemplateMapper extends DataMapperAbstract
'mapper' => AccountMapper::class, 'mapper' => AccountMapper::class,
'self' => 'helper_template_creator', 'self' => 'helper_template_creator',
], ],
'unit' => [
'mapper' => UnitMapper::class,
'self' => 'helper_template_unit',
],
]; ];
/** /**