mirror of
https://github.com/Karaka-Management/oms-Script.git
synced 2026-01-11 12:28:41 +00:00
implement app assoc.
This commit is contained in:
parent
d5479d4396
commit
c87f2af15e
|
|
@ -58,6 +58,13 @@
|
|||
"foreignTable": "account",
|
||||
"foreignKey": "account_id"
|
||||
},
|
||||
"helper_template_unit": {
|
||||
"name": "helper_template_unit",
|
||||
"type": "INT",
|
||||
"null": true,
|
||||
"foreignTable": "organization_unit",
|
||||
"foreignKey": "organization_unit_id"
|
||||
},
|
||||
"helper_template_created": {
|
||||
"name": "helper_template_created",
|
||||
"type": "DATETIME",
|
||||
|
|
|
|||
|
|
@ -107,6 +107,8 @@ class Report implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get model id.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -117,6 +119,8 @@ class Report implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the activity status
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -127,6 +131,8 @@ class Report implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the activity status
|
||||
*
|
||||
* @param int $status Report status
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -139,6 +145,8 @@ class Report implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get title,
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -149,6 +157,8 @@ class Report implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the title
|
||||
*
|
||||
* @param string $title Title
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -161,6 +171,8 @@ class Report implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -171,6 +183,8 @@ class Report implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the description
|
||||
*
|
||||
* @param string $description Description
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -183,6 +197,8 @@ class Report implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get raw description
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -193,6 +209,8 @@ class Report implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set raw description
|
||||
*
|
||||
* @param string $descriptionRaw Description
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -205,6 +223,8 @@ class Report implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get created datetime
|
||||
*
|
||||
* @return \DateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -215,6 +235,8 @@ class Report implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get creator
|
||||
*
|
||||
* @return int|\phpOMS\Account\Account
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -225,6 +247,8 @@ class Report implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set creator
|
||||
*
|
||||
* @param mixed $creator Created by
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -237,6 +261,8 @@ class Report implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get template this report belongs to
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -247,6 +273,8 @@ class Report implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set template this report belongs to
|
||||
*
|
||||
* @param mixed $template Report template
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -271,6 +301,8 @@ class Report implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get source media for the report
|
||||
*
|
||||
* @return \Modules\Media\Models\Collection|int
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -281,9 +313,7 @@ class Report implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
|
|
|
|||
|
|
@ -32,6 +32,14 @@ class Template implements \JsonSerializable
|
|||
*/
|
||||
private int $id = 0;
|
||||
|
||||
/**
|
||||
* Unit.
|
||||
*
|
||||
* @var null|int|\Modules\Organization\Models\Unit
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $unit = null;
|
||||
|
||||
/**
|
||||
* Template status.
|
||||
*
|
||||
|
|
@ -131,6 +139,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get model id
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -140,6 +150,34 @@ class Template implements \JsonSerializable
|
|||
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.
|
||||
*
|
||||
|
|
@ -157,6 +195,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set template name
|
||||
*
|
||||
* @param string $name Template name
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -169,6 +209,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get template name
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -179,6 +221,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description Template description
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -191,6 +235,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -201,6 +247,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set raw description
|
||||
*
|
||||
* @param string $description Template description
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -213,6 +261,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get raw description
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -223,6 +273,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set source media
|
||||
*
|
||||
* @param int $source Source
|
||||
*
|
||||
* @return mixed
|
||||
|
|
@ -235,6 +287,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get source media
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -245,6 +299,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set creator
|
||||
*
|
||||
* @param mixed $createdBy Creator
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -257,6 +313,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get creator
|
||||
*
|
||||
* @return int|\phpOMS\Account\Account
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -267,6 +325,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get created date
|
||||
*
|
||||
* @return \DateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -277,6 +337,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set expected files from reports
|
||||
*
|
||||
* @param array $expected Expected files
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -289,6 +351,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get expected files from report
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -299,6 +363,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Add expected file from report
|
||||
*
|
||||
* @param string $expected Expected file
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -311,6 +377,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set activity satuus
|
||||
*
|
||||
* @param int $status Template status (is active?)
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -323,6 +391,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get activity status
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -333,6 +403,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set data type basis
|
||||
*
|
||||
* @param int $datatype Template datatype source
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -345,6 +417,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get data type basis
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -367,6 +443,8 @@ class Template implements \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Does the template need report data?
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ namespace Modules\Helper\Models;
|
|||
|
||||
use Modules\Admin\Models\AccountMapper;
|
||||
use Modules\Media\Models\CollectionMapper;
|
||||
use Modules\Organization\Models\UnitMapper;
|
||||
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_media' => ['name' => 'helper_template_media', 'type' => 'int', 'internal' => 'source'],
|
||||
'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', ],
|
||||
];
|
||||
|
||||
|
|
@ -72,6 +74,10 @@ final class TemplateMapper extends DataMapperAbstract
|
|||
'mapper' => AccountMapper::class,
|
||||
'self' => 'helper_template_creator',
|
||||
],
|
||||
'unit' => [
|
||||
'mapper' => UnitMapper::class,
|
||||
'self' => 'helper_template_unit',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user