docblocks+api functions

This commit is contained in:
Dennis Eichhorn 2018-02-17 18:31:04 +01:00
parent d41eb1a094
commit 58682a7fb4
17 changed files with 620 additions and 71 deletions

View File

@ -4,7 +4,7 @@
* *
* PHP Version 7.1 * PHP Version 7.1
* *
* @package TBD * @package Modules\Organization\Admin\Install
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -19,7 +19,7 @@ use phpOMS\DataStorage\Database\DatabasePool;
/** /**
* Navigation class. * Navigation class.
* *
* @package Modules * @package Modules\Organization\Admin\Install
* @license OMS License 1.0 * @license OMS License 1.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
* @since 1.0.0 * @since 1.0.0

View File

@ -4,7 +4,7 @@
* *
* PHP Version 7.1 * PHP Version 7.1
* *
* @package TBD * @package Modules\Organization\Admin
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -22,7 +22,7 @@ use phpOMS\Module\InstallerAbstract;
/** /**
* Organization install class. * Organization install class.
* *
* @package Modules * @package Modules\Organization\Admin
* @license OMS License 1.0 * @license OMS License 1.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
* @since 1.0.0 * @since 1.0.0
@ -43,7 +43,8 @@ class Installer extends InstallerAbstract
'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'organization_unit` ( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'organization_unit` (
`organization_unit_id` int(11) NOT NULL AUTO_INCREMENT, `organization_unit_id` int(11) NOT NULL AUTO_INCREMENT,
`organization_unit_name` varchar(50) DEFAULT NULL, `organization_unit_name` varchar(50) DEFAULT NULL,
`organization_unit_description` varchar(255) DEFAULT NULL, `organization_unit_description` text DEFAULT NULL,
`organization_unit_descriptionraw` text DEFAULT NULL,
`organization_unit_parent` int(11) DEFAULT NULL, `organization_unit_parent` int(11) DEFAULT NULL,
`organization_unit_status` int(3) DEFAULT NULL, `organization_unit_status` int(3) DEFAULT NULL,
PRIMARY KEY (`organization_unit_id`), PRIMARY KEY (`organization_unit_id`),
@ -60,7 +61,8 @@ class Installer extends InstallerAbstract
'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'organization_department` ( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'organization_department` (
`organization_department_id` int(11) NOT NULL AUTO_INCREMENT, `organization_department_id` int(11) NOT NULL AUTO_INCREMENT,
`organization_department_name` varchar(30) DEFAULT NULL, `organization_department_name` varchar(30) DEFAULT NULL,
`organization_department_description` varchar(255) DEFAULT NULL, `organization_department_description` text DEFAULT NULL,
`organization_department_descriptionraw` text DEFAULT NULL,
`organization_department_parent` int(11) DEFAULT NULL, `organization_department_parent` int(11) DEFAULT NULL,
`organization_department_status` int(3) DEFAULT NULL, `organization_department_status` int(3) DEFAULT NULL,
`organization_department_unit` int(11) NOT NULL, `organization_department_unit` int(11) NOT NULL,
@ -80,7 +82,8 @@ class Installer extends InstallerAbstract
'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'organization_position` ( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'organization_position` (
`organization_position_id` int(11) NOT NULL AUTO_INCREMENT, `organization_position_id` int(11) NOT NULL AUTO_INCREMENT,
`organization_position_name` varchar(50) DEFAULT NULL, `organization_position_name` varchar(50) DEFAULT NULL,
`organization_position_description` varchar(255) DEFAULT NULL, `organization_position_description` text DEFAULT NULL,
`organization_position_descriptionraw` text DEFAULT NULL,
`organization_position_parent` int(11) DEFAULT NULL, `organization_position_parent` int(11) DEFAULT NULL,
`organization_position_department` int(11) DEFAULT NULL, `organization_position_department` int(11) DEFAULT NULL,
`organization_position_status` int(3) DEFAULT NULL, `organization_position_status` int(3) DEFAULT NULL,

View File

@ -4,7 +4,7 @@
* *
* PHP Version 7.1 * PHP Version 7.1
* *
* @package TBD * @package Modules\Organization\Admin
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -21,7 +21,7 @@ use phpOMS\Module\InfoManager;
/** /**
* Navigation class. * Navigation class.
* *
* @package Modules * @package Modules\Organization\Admin
* @license OMS License 1.0 * @license OMS License 1.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
* @since 1.0.0 * @since 1.0.0

View File

@ -4,7 +4,7 @@
* *
* PHP Version 7.1 * PHP Version 7.1
* *
* @package TBD * @package Modules\Organization\Admin
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -22,7 +22,7 @@ use phpOMS\Module\InfoManager;
/** /**
* Navigation class. * Navigation class.
* *
* @package Modules * @package Modules\Organization\Admin
* @license OMS License 1.0 * @license OMS License 1.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
* @since 1.0.0 * @since 1.0.0

View File

@ -4,7 +4,7 @@
* *
* PHP Version 7.1 * PHP Version 7.1
* *
* @package TBD * @package Modules\Organization\Admin
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -22,7 +22,7 @@ use phpOMS\Module\InfoManager;
/** /**
* Navigation class. * Navigation class.
* *
* @package Modules * @package Modules\Organization\Admin
* @license OMS License 1.0 * @license OMS License 1.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
* @since 1.0.0 * @since 1.0.0

View File

@ -4,7 +4,7 @@
* *
* PHP Version 7.1 * PHP Version 7.1
* *
* @package TBD * @package Modules\Organization
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -28,6 +28,7 @@ use phpOMS\Module\ModuleAbstract;
use phpOMS\Module\WebInterface; use phpOMS\Module\WebInterface;
use phpOMS\Views\View; use phpOMS\Views\View;
use phpOMS\Message\Http\RequestStatusCode; use phpOMS\Message\Http\RequestStatusCode;
use phpOMS\Utils\Parser\Markdown\Markdown;
use phpOMS\Account\PermissionType; use phpOMS\Account\PermissionType;
use Modules\Organization\Models\PermissionState; use Modules\Organization\Models\PermissionState;
@ -35,7 +36,7 @@ use Modules\Organization\Models\PermissionState;
/** /**
* Organization Controller class. * Organization Controller class.
* *
* @package Modules * @package Modules\Organization
* @license OMS License 1.0 * @license OMS License 1.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
* @since 1.0.0 * @since 1.0.0
@ -459,7 +460,8 @@ class Controller extends ModuleAbstract implements WebInterface
{ {
$unit = UnitMapper::get((int) $request->getData('id')); $unit = UnitMapper::get((int) $request->getData('id'));
$unit->setName((string) ($request->getData('name') ?? $unit->getName())); $unit->setName((string) ($request->getData('name') ?? $unit->getName()));
$unit->setDescription((string) ($request->getData('description') ?? $unit->getDescription())); $unit->setDescriptionRaw((string) ($request->getData('description') ?? $unit->getDescriptionRaw()));
$unit->setDescription(Markdown::parse((string) ($request->getData('description') ?? $unit->getDescriptionRaw())));
$parent = (int) $request->getData('parent'); $parent = (int) $request->getData('parent');
$unit->setParent(!empty($parent) ? $parent : $unit->getParent()); $unit->setParent(!empty($parent) ? $parent : $unit->getParent());
@ -551,7 +553,8 @@ class Controller extends ModuleAbstract implements WebInterface
{ {
$unit = new Unit(); $unit = new Unit();
$unit->setName((string) $request->getData('name')); $unit->setName((string) $request->getData('name'));
$unit->setDescription((string) ($request->getData('description') ?? '')); $unit->setDescriptionRaw((string) ($request->getData('description') ?? ''));
$unit->setDescription(Markdwon::parse((string) ($request->getData('description') ?? '')));
$parent = (int) $request->getData('parent'); $parent = (int) $request->getData('parent');
$unit->setParent(!empty($parent) ? $parent : null); $unit->setParent(!empty($parent) ? $parent : null);
@ -695,7 +698,8 @@ class Controller extends ModuleAbstract implements WebInterface
{ {
$position = PositionMapper::get((int) $request->getData('id')); $position = PositionMapper::get((int) $request->getData('id'));
$position->setName((string) ($request->getData('name') ?? $position->getName())); $position->setName((string) ($request->getData('name') ?? $position->getName()));
$position->setDescription((string) ($request->getData('description') ?? $position->getDescription())); $position->setDescriptionRaw((string) ($request->getData('description') ?? $position->getDescriptionRaw()));
$position->setDescription(Markdown::parse((string) ($request->getData('description') ?? $position->getDescriptionRaw())));
$parent = (int) $request->getData('parent'); $parent = (int) $request->getData('parent');
$position->setParent(!empty($parent) ? $parent : $position->getParent()); $position->setParent(!empty($parent) ? $parent : $position->getParent());
@ -759,7 +763,8 @@ class Controller extends ModuleAbstract implements WebInterface
$position = new Position(); $position = new Position();
$position->setName((string) ($request->getData('name'))); $position->setName((string) ($request->getData('name')));
$position->setStatus((int) $request->getData('status')); $position->setStatus((int) $request->getData('status'));
$position->setDescription((string) ($request->getData('description') ?? '')); $position->setDescriptionRaw((string) ($request->getData('description') ?? ''));
$position->setDescription(Markdown::parse((string) ($request->getData('description') ?? '')));
$parent = (int) $request->getData('parent'); $parent = (int) $request->getData('parent');
$position->setParent(!empty($parent) ? $parent : null); $position->setParent(!empty($parent) ? $parent : null);
@ -873,7 +878,8 @@ class Controller extends ModuleAbstract implements WebInterface
{ {
$department = DepartmentMapper::get((int) $request->getData('id')); $department = DepartmentMapper::get((int) $request->getData('id'));
$department->setName((string) ($request->getData('name') ?? $department->getName())); $department->setName((string) ($request->getData('name') ?? $department->getName()));
$department->setDescription((string) ($request->getData('description') ?? $department->getDescription())); $department->setDescriptionRaw((string) ($request->getData('description') ?? $department->getDescriptionRaw()));
$department->setDescription(Markdown::parse((string) ($request->getData('description') ?? $department->getDescriptionRaw())));
$parent = (int) $request->getData('parent'); $parent = (int) $request->getData('parent');
$department->setParent(!empty($parent) ? $parent : $department->getParent()); $department->setParent(!empty($parent) ? $parent : $department->getParent());
@ -973,7 +979,8 @@ class Controller extends ModuleAbstract implements WebInterface
$parent = (int) $request->getData('parent'); $parent = (int) $request->getData('parent');
$department->setParent(!empty($parent) ? $parent : null); $department->setParent(!empty($parent) ? $parent : null);
$department->setUnit((int) ($request->getData('unit') ?? 1)); $department->setUnit((int) ($request->getData('unit') ?? 1));
$department->setDescription((string) ($request->getData('description') ?? '')); $department->setDescriptionRaw((string) ($request->getData('description') ?? ''));
$department->setDescription(Markdown::parse((string) ($request->getData('description') ?? '')));
return $department; return $department;
} }

View File

@ -4,7 +4,7 @@
* *
* PHP Version 7.1 * PHP Version 7.1
* *
* @package TBD * @package Modules\Organization
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -14,75 +14,243 @@ declare(strict_types=1);
namespace Modules\Organization\Models; namespace Modules\Organization\Models;
class Department /**
* Organization department class.
*
* @package Modules\Organization
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
*/
class Department implements ArrayableInterface, \JsonSerializable
{ {
/**
* Article ID.
*
* @var int
* @since 1.0.0
*/
protected $id = 0; protected $id = 0;
/**
* Name.
*
* @var string
* @since 1.0.0
*/
protected $name = ''; protected $name = '';
/**
* Parent
*
* @var mixed
* @since 1.0.0
*/
protected $parent = null; protected $parent = null;
/**
* Status
*
* @var int
* @since 1.0.0
*/
protected $status = Status::INACTIVE; protected $status = Status::INACTIVE;
/**
* Unit this department belongs to
*
* @var mixed
* @since 1.0.0
*/
protected $unit = 1; protected $unit = 1;
/**
* Description.
*
* @var string
* @since 1.0.0
*/
protected $description = ''; protected $description = '';
/**
* Description.
*
* @var string
* @since 1.0.0
*/
protected $descriptionRaw = '';
/**
* Get id
*
* @return int
*
* @since 1.0.0
*/
public function getId() : int public function getId() : int
{ {
return $this->id; return $this->id;
} }
/**
* Get name
*
* @return string
*
* @since 1.0.0
*/
public function getName() : string public function getName() : string
{ {
return $this->name; return $this->name;
} }
/**
* Set name
*
* @param string $name Name
*
* @return void
*
* @since 1.0.0
*/
public function setName(string $name) public function setName(string $name)
{ {
return $this->name = $name; return $this->name = $name;
} }
/**
* Get parent
*
* @return mixed
*
* @since 1.0.0
*/
public function getParent() public function getParent()
{ {
return $this->parent ?? new NullDepartment(); return $this->parent ?? new NullDepartment();
} }
/**
* Set parent
*
* @param mixed $parent Parent
*
* @return mixed
*
* @since 1.0.0
*/
public function setParent($parent) public function setParent($parent)
{ {
$this->parent = $parent; $this->parent = $parent;
} }
/**
* Get status
*
* @return int
*
* @since 1.0.0
*/
public function getStatus() : int public function getStatus() : int
{ {
return $this->status; return $this->status;
} }
/**
* Set status
*
* @param int $status Status
*
* @return void
*
* @since 1.0.0
*/
public function setStatus(int $status) public function setStatus(int $status)
{ {
$this->status = $status; $this->status = $status;
} }
/**
* Get unit
*
* @return mixed
*
* @since 1.0.0
*/
public function getUnit() public function getUnit()
{ {
return $this->unit ?? new NullUnit(); return $this->unit ?? new NullUnit();
} }
/**
* Set unit
*
* @param mixed $unit Unit
*
* @return mixed
*
* @since 1.0.0
*/
public function setUnit($unit) public function setUnit($unit)
{ {
$this->unit = $unit; $this->unit = $unit;
} }
/**
* Get description
*
* @return string
*
* @since 1.0.0
*/
public function getDescription() : string public function getDescription() : string
{ {
return $this->description; return $this->description;
} }
/**
* Set description
*
* @param int $desc Description
*
* @return void
*
* @since 1.0.0
*/
public function setDescription(string $desc) public function setDescription(string $desc)
{ {
$this->description = $desc; $this->description = $desc;
} }
/**
* Get description
*
* @return string
*
* @since 1.0.0
*/
public function getDescriptionRaw() : string
{
return $this->descriptionRaw;
}
/**
* Set description
*
* @param int $desc Description
*
* @return void
*
* @since 1.0.0
*/
public function setDescriptionRaw(string $desc)
{
$this->descriptionRaw = $desc;
}
/**
* {@inheritdoc}
*/
public function toArray() : array public function toArray() : array
{ {
return [ return [
@ -106,11 +274,7 @@ class Department
} }
/** /**
* Json serialize. * {@inheritdoc}
*
* @return string
*
* @since 1.0.0
*/ */
public function jsonSerialize() public function jsonSerialize()
{ {

View File

@ -4,7 +4,7 @@
* *
* PHP Version 7.1 * PHP Version 7.1
* *
* @package TBD * @package Modules\Organization
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -16,6 +16,14 @@ namespace Modules\Organization\Models;
use phpOMS\DataStorage\Database\DataMapperAbstract; use phpOMS\DataStorage\Database\DataMapperAbstract;
/**
* Organization department mapper class.
*
* @package Modules\Organization
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
*/
class DepartmentMapper extends DataMapperAbstract class DepartmentMapper extends DataMapperAbstract
{ {
/** /**
@ -25,14 +33,21 @@ class DepartmentMapper extends DataMapperAbstract
* @since 1.0.0 * @since 1.0.0
*/ */
protected static $columns = [ protected static $columns = [
'organization_department_id' => ['name' => 'organization_department_id', 'type' => 'int', 'internal' => 'id'], 'organization_department_id' => ['name' => 'organization_department_id', 'type' => 'int', 'internal' => 'id'],
'organization_department_name' => ['name' => 'organization_department_name', 'type' => 'string', 'internal' => 'name'], 'organization_department_name' => ['name' => 'organization_department_name', 'type' => 'string', 'internal' => 'name'],
'organization_department_description' => ['name' => 'organization_department_description', 'type' => 'string', 'internal' => 'description'], 'organization_department_description' => ['name' => 'organization_department_description', 'type' => 'string', 'internal' => 'description'],
'organization_department_parent' => ['name' => 'organization_department_parent', 'type' => 'int', 'internal' => 'parent'], 'organization_department_descriptionraw' => ['name' => 'organization_department_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'],
'organization_department_status' => ['name' => 'organization_department_status', 'type' => 'int', 'internal' => 'status'], 'organization_department_parent' => ['name' => 'organization_department_parent', 'type' => 'int', 'internal' => 'parent'],
'organization_department_unit' => ['name' => 'organization_department_unit', 'type' => 'int', 'internal' => 'unit'], 'organization_department_status' => ['name' => 'organization_department_status', 'type' => 'int', 'internal' => 'status'],
'organization_department_unit' => ['name' => 'organization_department_unit', 'type' => 'int', 'internal' => 'unit'],
]; ];
/**
* Belongs to.
*
* @var array
* @since 1.0.0
*/
protected static $belongsTo = [ protected static $belongsTo = [
'unit' => [ 'unit' => [
'mapper' => UnitMapper::class, 'mapper' => UnitMapper::class,

View File

@ -4,7 +4,7 @@
* *
* PHP Version 7.1 * PHP Version 7.1
* *
* @package TBD * @package Modules\Organization
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -14,6 +14,14 @@ declare(strict_types=1);
namespace Modules\Organization\Models; namespace Modules\Organization\Models;
/**
* Organization null class.
*
* @package Modules\Organization
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
*/
class NullDepartment extends Department class NullDepartment extends Department
{ {
} }

View File

@ -4,7 +4,7 @@
* *
* PHP Version 7.1 * PHP Version 7.1
* *
* @package TBD * @package Modules\Organization
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -14,6 +14,14 @@ declare(strict_types=1);
namespace Modules\Organization\Models; namespace Modules\Organization\Models;
/**
* Organization null class.
*
* @package Modules\Organization
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
*/
class NullPosition extends Position class NullPosition extends Position
{ {
} }

View File

@ -4,7 +4,7 @@
* *
* PHP Version 7.1 * PHP Version 7.1
* *
* @package TBD * @package Modules\Organization
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -14,6 +14,14 @@ declare(strict_types=1);
namespace Modules\Organization\Models; namespace Modules\Organization\Models;
/**
* Organization null class.
*
* @package Modules\Organization
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
*/
class NullUnit extends Unit class NullUnit extends Unit
{ {
} }

View File

@ -4,7 +4,7 @@
* *
* PHP Version 7.1 * PHP Version 7.1
* *
* @package TBD * @package Modules\Organization
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -19,7 +19,7 @@ use phpOMS\Stdlib\Base\Enum;
/** /**
* Permision state enum. * Permision state enum.
* *
* @package Tasks * @package Modules\Organization
* @license OMS License 1.0 * @license OMS License 1.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
* @since 1.0.0 * @since 1.0.0

View File

@ -4,7 +4,7 @@
* *
* PHP Version 7.1 * PHP Version 7.1
* *
* @package TBD * @package Modules\Organization
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -16,75 +16,243 @@ namespace Modules\Organization\Models;
use phpOMS\Contract\ArrayableInterface; use phpOMS\Contract\ArrayableInterface;
/**
* Organization position class.
*
* @package Modules\Organization
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
*/
class Position implements ArrayableInterface, \JsonSerializable class Position implements ArrayableInterface, \JsonSerializable
{ {
/**
* Article ID.
*
* @var int
* @since 1.0.0
*/
private $id = 0; private $id = 0;
/**
* Name.
*
* @var string
* @since 1.0.0
*/
private $name = ''; private $name = '';
/**
* Parent
*
* @var mixed
* @since 1.0.0
*/
private $parent = null; private $parent = null;
/**
* Department
*
* @var mixed
* @since 1.0.0
*/
private $department = null; private $department = null;
/**
* Description.
*
* @var string
* @since 1.0.0
*/
private $description = ''; private $description = '';
/**
* Description.
*
* @var string
* @since 1.0.0
*/
private $descriptionRaw = '';
/**
* Status
*
* @var int
* @since 1.0.0
*/
protected $status = Status::INACTIVE; protected $status = Status::INACTIVE;
/**
* Get id
*
* @return int
*
* @since 1.0.0
*/
public function getId() : int public function getId() : int
{ {
return $this->id; return $this->id;
} }
/**
* Get name
*
* @return string
*
* @since 1.0.0
*/
public function getName() : string public function getName() : string
{ {
return $this->name; return $this->name;
} }
/**
* Set name
*
* @param string $name Name
*
* @return void
*
* @since 1.0.0
*/
public function setName(string $name) public function setName(string $name)
{ {
$this->name = $name; $this->name = $name;
} }
/**
* Get parent
*
* @return mixed
*
* @since 1.0.0
*/
public function getParent() public function getParent()
{ {
return $this->parent ?? new NullPosition(); return $this->parent ?? new NullPosition();
} }
/**
* Set parent
*
* @param mixed $parent Parent
*
* @return mixed
*
* @since 1.0.0
*/
public function setParent($parent) public function setParent($parent)
{ {
$this->parent = $parent; $this->parent = $parent;
} }
/**
* Get parent
*
* @return mixed
*
* @since 1.0.0
*/
public function getDepartment() public function getDepartment()
{ {
return $this->department ?? new NullDepartment(); return $this->department ?? new NullDepartment();
} }
/**
* Set department
*
* @param mixed $department Department
*
* @return mixed
*
* @since 1.0.0
*/
public function setDepartment($department) public function setDepartment($department)
{ {
$this->department = $department; $this->department = $department;
} }
/**
* Get status
*
* @return int
*
* @since 1.0.0
*/
public function getStatus() : int public function getStatus() : int
{ {
return $this->status; return $this->status;
} }
/**
* Set status
*
* @param int $status Status
*
* @return void
*
* @since 1.0.0
*/
public function setStatus(int $status) public function setStatus(int $status)
{ {
$this->status = $status; $this->status = $status;
} }
/**
* Get description
*
* @return string
*
* @since 1.0.0
*/
public function getDescription() : string public function getDescription() : string
{ {
return $this->description; return $this->description;
} }
/**
* Set description
*
* @param int $desc Description
*
* @return void
*
* @since 1.0.0
*/
public function setDescription(string $desc) public function setDescription(string $desc)
{ {
$this->description = $desc; $this->description = $desc;
} }
/**
* Get description
*
* @return string
*
* @since 1.0.0
*/
public function getDescriptionRaw() : string
{
return $this->descriptionRaw;
}
/**
* Set description
*
* @param int $desc Description
*
* @return void
*
* @since 1.0.0
*/
public function setDescriptionRaw(string $desc)
{
$this->descriptionRaw = $desc;
}
/**
* {@inheritdoc}
*/
public function toArray() : array public function toArray() : array
{ {
return [ return [
@ -109,11 +277,7 @@ class Position implements ArrayableInterface, \JsonSerializable
} }
/** /**
* Json serialize. * {@inheritdoc}
*
* @return string
*
* @since 1.0.0
*/ */
public function jsonSerialize() public function jsonSerialize()
{ {

View File

@ -4,7 +4,7 @@
* *
* PHP Version 7.1 * PHP Version 7.1
* *
* @package TBD * @package Modules\Organization
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -16,6 +16,14 @@ namespace Modules\Organization\Models;
use phpOMS\DataStorage\Database\DataMapperAbstract; use phpOMS\DataStorage\Database\DataMapperAbstract;
/**
* Organization position mapper class.
*
* @package Modules\Organization
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
*/
class PositionMapper extends DataMapperAbstract class PositionMapper extends DataMapperAbstract
{ {
@ -26,14 +34,21 @@ class PositionMapper extends DataMapperAbstract
* @since 1.0.0 * @since 1.0.0
*/ */
protected static $columns = [ protected static $columns = [
'organization_position_id' => ['name' => 'organization_position_id', 'type' => 'int', 'internal' => 'id'], 'organization_position_id' => ['name' => 'organization_position_id', 'type' => 'int', 'internal' => 'id'],
'organization_position_name' => ['name' => 'organization_position_name', 'type' => 'string', 'internal' => 'name'], 'organization_position_name' => ['name' => 'organization_position_name', 'type' => 'string', 'internal' => 'name'],
'organization_position_description' => ['name' => 'organization_position_description', 'type' => 'string', 'internal' => 'description'], 'organization_position_description' => ['name' => 'organization_position_description', 'type' => 'string', 'internal' => 'description'],
'organization_position_parent' => ['name' => 'organization_position_parent', 'type' => 'int', 'internal' => 'parent'], 'organization_position_descriptionraw' => ['name' => 'organization_position_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'],
'organization_position_department' => ['name' => 'organization_position_department', 'type' => 'int', 'internal' => 'department'], 'organization_position_parent' => ['name' => 'organization_position_parent', 'type' => 'int', 'internal' => 'parent'],
'organization_position_status' => ['name' => 'organization_position_status', 'type' => 'int', 'internal' => 'status'], 'organization_position_department' => ['name' => 'organization_position_department', 'type' => 'int', 'internal' => 'department'],
'organization_position_status' => ['name' => 'organization_position_status', 'type' => 'int', 'internal' => 'status'],
]; ];
/**
* Belongs to.
*
* @var array
* @since 1.0.0
*/
protected static $belongsTo = [ protected static $belongsTo = [
'parent' => [ 'parent' => [
'mapper' => PositionMapper::class, 'mapper' => PositionMapper::class,

View File

@ -4,7 +4,7 @@
* *
* PHP Version 7.1 * PHP Version 7.1
* *
* @package TBD * @package Modules\Organization
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -19,7 +19,7 @@ use phpOMS\Stdlib\Base\Enum;
/** /**
* Accept status enum. * Accept status enum.
* *
* @package Calendar * @package Modules\Organization
* @license OMS License 1.0 * @license OMS License 1.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
* @since 1.0.0 * @since 1.0.0

View File

@ -4,7 +4,7 @@
* *
* PHP Version 7.1 * PHP Version 7.1
* *
* @package TBD * @package Modules\Organization
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -16,63 +16,209 @@ namespace Modules\Organization\Models;
use phpOMS\Contract\ArrayableInterface; use phpOMS\Contract\ArrayableInterface;
/**
* Organization unit class.
*
* @package Modules\Organization
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
*/
class Unit implements ArrayableInterface, \JsonSerializable class Unit implements ArrayableInterface, \JsonSerializable
{ {
/**
* Article ID.
*
* @var int
* @since 1.0.0
*/
private $id = 0; private $id = 0;
/**
* Name.
*
* @var string
* @since 1.0.0
*/
private $name = ''; private $name = '';
/**
* Parent
*
* @var mixed
* @since 1.0.0
*/
private $parent = null; private $parent = null;
/**
* Description.
*
* @var string
* @since 1.0.0
*/
private $description = ''; private $description = '';
/**
* Description.
*
* @var string
* @since 1.0.0
*/
protected $descriptionRaw = '';
/**
* Status
*
* @var int
* @since 1.0.0
*/
protected $status = Status::INACTIVE; protected $status = Status::INACTIVE;
/**
* Get id
*
* @return int
*
* @since 1.0.0
*/
public function getId() : int public function getId() : int
{ {
return $this->id; return $this->id;
} }
/**
* Get name
*
* @return string
*
* @since 1.0.0
*/
public function getName() : string public function getName() : string
{ {
return $this->name; return $this->name;
} }
public function setName(string $name) /**
* Set name
*
* @param string $name Name
*
* @return void
*
* @since 1.0.0
*/
public function setName(string $name) /* : void */
{ {
$this->name = $name; $this->name = $name;
} }
/**
* Get parent
*
* @return mixed
*
* @since 1.0.0
*/
public function getParent() public function getParent()
{ {
return $this->parent ?? new NullUnit(); return $this->parent ?? new NullUnit();
} }
public function setParent($parent) /**
* Set parent
*
* @param mixed $parent Parent
*
* @return mixed
*
* @since 1.0.0
*/
public function setParent($parent) /* : void */
{ {
$this->parent = $parent; $this->parent = $parent;
} }
/**
* Get status
*
* @return int
*
* @since 1.0.0
*/
public function getStatus() : int public function getStatus() : int
{ {
return $this->status; return $this->status;
} }
public function setStatus(int $status) /**
* Set status
*
* @param int $status Status
*
* @return void
*
* @since 1.0.0
*/
public function setStatus(int $status) /* : void */
{ {
$this->status = $status; $this->status = $status;
} }
/**
* Get description
*
* @return string
*
* @since 1.0.0
*/
public function getDescription() : string public function getDescription() : string
{ {
return $this->description; return $this->description;
} }
public function setDescription(string $desc) /**
* Set description
*
* @param int $desc Description
*
* @return void
*
* @since 1.0.0
*/
public function setDescription(string $desc) /* : void */
{ {
$this->description = $desc; $this->description = $desc;
} }
/**
* Get description
*
* @return string
*
* @since 1.0.0
*/
public function getDescriptionRaw() : string
{
return $this->descriptionRaw;
}
/**
* Set description
*
* @param int $desc Description
*
* @return void
*
* @since 1.0.0
*/
public function setDescriptionRaw(string $desc)
{
$this->descriptionRaw = $desc;
}
/**
* {@inheritdoc}
*/
public function toArray() : array public function toArray() : array
{ {
return [ return [
@ -96,11 +242,7 @@ class Unit implements ArrayableInterface, \JsonSerializable
} }
/** /**
* Json serialize. * {@inheritdoc}
*
* @return string
*
* @since 1.0.0
*/ */
public function jsonSerialize() public function jsonSerialize()
{ {

View File

@ -4,7 +4,7 @@
* *
* PHP Version 7.1 * PHP Version 7.1
* *
* @package TBD * @package Modules\Organization
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -16,6 +16,14 @@ namespace Modules\Organization\Models;
use phpOMS\DataStorage\Database\DataMapperAbstract; use phpOMS\DataStorage\Database\DataMapperAbstract;
/**
* Organization unit mapper class.
*
* @package Modules\Organization
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
*/
class UnitMapper extends DataMapperAbstract class UnitMapper extends DataMapperAbstract
{ {
/** /**
@ -25,13 +33,20 @@ class UnitMapper extends DataMapperAbstract
* @since 1.0.0 * @since 1.0.0
*/ */
protected static $columns = [ protected static $columns = [
'organization_unit_id' => ['name' => 'organization_unit_id', 'type' => 'int', 'internal' => 'id'], 'organization_unit_id' => ['name' => 'organization_unit_id', 'type' => 'int', 'internal' => 'id'],
'organization_unit_name' => ['name' => 'organization_unit_name', 'type' => 'string', 'internal' => 'name'], 'organization_unit_name' => ['name' => 'organization_unit_name', 'type' => 'string', 'internal' => 'name'],
'organization_unit_description' => ['name' => 'organization_unit_description', 'type' => 'string', 'internal' => 'description'], 'organization_unit_description' => ['name' => 'organization_unit_description', 'type' => 'string', 'internal' => 'description'],
'organization_unit_parent' => ['name' => 'organization_unit_parent', 'type' => 'int', 'internal' => 'parent'], 'organization_unit_descriptionraw' => ['name' => 'organization_unit_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'],
'organization_unit_status' => ['name' => 'organization_unit_status', 'type' => 'int', 'internal' => 'status'], 'organization_unit_parent' => ['name' => 'organization_unit_parent', 'type' => 'int', 'internal' => 'parent'],
'organization_unit_status' => ['name' => 'organization_unit_status', 'type' => 'int', 'internal' => 'status'],
]; ];
/**
* Belongs to.
*
* @var array
* @since 1.0.0
*/
protected static $belongsTo = [ protected static $belongsTo = [
'account' => [ 'account' => [
'mapper' => UnitMapper::class, 'mapper' => UnitMapper::class,