Implement RiskManagement models (not working)

No errors need to be fixed
This commit is contained in:
Dennis Eichhorn 2017-07-02 22:02:50 +02:00
parent 6ea6ea272d
commit 2bf57924df
26 changed files with 2099 additions and 44 deletions

View File

@ -48,36 +48,88 @@ class Installer extends InstallerAbstract
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_category` (
`riskmngmt_category_id` int(11) NOT NULL,
`riskmngmt_category_name` varchar(50) NOT NULL,
`riskmngmt_category_description` text NOT NULL,
`riskmngmt_category_descriptionraw` text NOT NULL,
`riskmngmt_category_parent` int(11) DEFAULT NULL,
`riskmngmt_category_responsible` int(11) NOT NULL,
`riskmngmt_category_deputy` int(11) NOT NULL,
PRIMARY KEY (`riskmngmt_category_id`),
KEY `riskmngmt_category_parent` (`riskmngmt_category_parent`),
KEY `riskmngmt_category_responsible` (`riskmngmt_category_responsible`)
KEY `riskmngmt_category_responsible` (`riskmngmt_category_responsible`),
KEY `riskmngmt_category_deputy` (`riskmngmt_category_deputy`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
)->execute();
$dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_category`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_category_ibfk_1` FOREIGN KEY (`riskmngmt_category_parent`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_category` (`riskmngmt_category_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_category_ibfk_2` FOREIGN KEY (`riskmngmt_category_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_category_ibfk_2` FOREIGN KEY (`riskmngmt_category_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_category_ibfk_3` FOREIGN KEY (`riskmngmt_category_deputy`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
)->execute();
// TODO: more (media, start, end etc...)
$dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_process` (
`riskmngmt_process_id` int(11) NOT NULL,
`riskmngmt_process_name` text NOT NULL,
`riskmngmt_process_description` text NOT NULL,
`riskmngmt_process_descriptionraw` text NOT NULL,
`riskmngmt_process_unit` int(11) NOT NULL,
`riskmngmt_process_responsible` int(11) NOT NULL,
`riskmngmt_process_deputy` int(11) NOT NULL,
PRIMARY KEY (`riskmngmt_process_id`),
KEY `riskmngmt_process_unit` (`riskmngmt_process_unit`),
KEY `riskmngmt_process_responsible` (`riskmngmt_process_responsible`)
KEY `riskmngmt_process_responsible` (`riskmngmt_process_responsible`),
KEY `riskmngmt_process_deputy` (`riskmngmt_process_deputy`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
)->execute();
$dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_process`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_process_ibfk_1` FOREIGN KEY (`riskmngmt_process_unit`) REFERENCES `' . $dbPool->get('core')->prefix . 'organization_unit` (`organization_unit_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_process_ibfk_2` FOREIGN KEY (`riskmngmt_process_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_process_ibfk_2` FOREIGN KEY (`riskmngmt_process_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_process_ibfk_3` FOREIGN KEY (`riskmngmt_process_deputy`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
)->execute();
// todo: only install if projectmanagement exists
$dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_project` (
`riskmngmt_project_id` int(11) NOT NULL,
`riskmngmt_project_project` int(11) NOT NULL,
`riskmngmt_project_responsible` int(11) NOT NULL,
`riskmngmt_project_deputy` int(11) NOT NULL,
PRIMARY KEY (`riskmngmt_project_id`),
KEY `riskmngmt_project_project` (`riskmngmt_project_project`),
KEY `riskmngmt_project_responsible` (`riskmngmt_project_responsible`),
KEY `riskmngmt_project_deputy` (`riskmngmt_project_deputy`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
)->execute();
$dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_project`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_project_ibfk_1` FOREIGN KEY (`riskmngmt_project_project`) REFERENCES `' . $dbPool->get('core')->prefix . 'projectmanagement_project` (`projectmanagement_project_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_project_ibfk_2` FOREIGN KEY (`riskmngmt_project_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_project_ibfk_3` FOREIGN KEY (`riskmngmt_project_deputy`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
)->execute();
$dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_department` (
`riskmngmt_department_id` int(11) NOT NULL,
`riskmngmt_department_department` int(11) NOT NULL,
`riskmngmt_department_responsible` int(11) NOT NULL,
`riskmngmt_department_deputy` int(11) NOT NULL,
PRIMARY KEY (`riskmngmt_department_id`),
KEY `riskmngmt_department_department` (`riskmngmt_department_department`),
KEY `riskmngmt_department_responsible` (`riskmngmt_department_responsible`),
KEY `riskmngmt_department_deputy` (`riskmngmt_department_deputy`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
)->execute();
$dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_department`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_department_ibfk_1` FOREIGN KEY (`riskmngmt_department_department`) REFERENCES `' . $dbPool->get('core')->prefix . 'organization_department` (`organization_department_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_department_ibfk_2` FOREIGN KEY (`riskmngmt_department_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_department_ibfk_3` FOREIGN KEY (`riskmngmt_department_deputy`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
)->execute();
$dbPool->get('core')->con->prepare(
@ -85,23 +137,27 @@ class Installer extends InstallerAbstract
`riskmngmt_risk_id` int(11) NOT NULL,
`riskmngmt_risk_name` varchar(255) NOT NULL,
`riskmngmt_risk_description` text NOT NULL,
`riskmngmt_risk_descriptionraw` text NOT NULL,
`riskmngmt_risk_unit` int(11) NOT NULL,
`riskmngmt_risk_deptartment` int(11) DEFAULT NULL,
`riskmngmt_risk_department` int(11) DEFAULT NULL,
`riskmngmt_risk_category` int(11) DEFAULT NULL,
`riskmngmt_risk_project` int(11) DEFAULT NULL,
`riskmngmt_risk_process` int(11) DEFAULT NULL,
`riskmngmt_risk_responsible` int(11) DEFAULT NULL,
`riskmngmt_risk_deputy` int(11) DEFAULT NULL,
`riskmngmt_risk_created_at` datetime DEFAULT NULL,
PRIMARY KEY (`riskmngmt_risk_id`),
KEY `riskmngmt_risk_unit` (`riskmngmt_risk_unit`),
KEY `riskmngmt_risk_responsible` (`riskmngmt_risk_responsible`)
KEY `riskmngmt_risk_responsible` (`riskmngmt_risk_responsible`),
KEY `riskmngmt_risk_deputy` (`riskmngmt_risk_deputy`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
)->execute();
$dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_risk`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_ibfk_1` FOREIGN KEY (`riskmngmt_risk_unit`) REFERENCES `' . $dbPool->get('core')->prefix . 'organization_unit` (`organization_unit_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_ibfk_2` FOREIGN KEY (`riskmngmt_risk_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_ibfk_2` FOREIGN KEY (`riskmngmt_risk_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_ibfk_3` FOREIGN KEY (`riskmngmt_risk_deputy`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
)->execute();
$dbPool->get('core')->con->prepare(
@ -129,9 +185,10 @@ class Installer extends InstallerAbstract
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_object` (
`riskmngmt_risk_object_id` int(11) NOT NULL,
`riskmngmt_risk_object_name` varchar(50) NOT NULL,
`riskmngmt_risk_object_description` text NOT NULL,
`riskmngmt_risk_object_descriptionraw` text NOT NULL,
`riskmngmt_risk_object_risk` int(11) NOT NULL,
PRIMARY KEY (`riskmngmt_risk_object_id`),
KEY `riskmngmt_risk_object_risk` (`riskmngmt_risk_object_risk`)
PRIMARY KEY (`riskmngmt_risk_object_id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
)->execute();
@ -159,57 +216,62 @@ class Installer extends InstallerAbstract
$dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_media` (
`riskmngmt_risk_media_id` int(11) NOT NULL,
`riskmngmt_risk_media_risk` int(11) NOT NULL,
`riskmngmt_risk_media_media` int(11) NOT NULL,
PRIMARY KEY (`riskmngmt_risk_media_id`),
KEY `riskmngmt_risk_media_risk` (`riskmngmt_risk_media_risk`),
KEY `riskmngmt_risk_media_media` (`riskmngmt_risk_media_media`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
)->execute();
$dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_media`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_media_ibfk_1` FOREIGN KEY (`riskmngmt_risk_media_media`) REFERENCES `' . $dbPool->get('core')->prefix . 'media` (`media_id`);'
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_media_ibfk_1` FOREIGN KEY (`riskmngmt_risk_media_risk`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_risk` (`riskmngmt_risk_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_media_ibfk_2` FOREIGN KEY (`riskmngmt_risk_media_media`) REFERENCES `' . $dbPool->get('core')->prefix . 'media` (`media_id`);'
)->execute();
$dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_cause` (
`riskmngmt_risk_cause_id` int(11) NOT NULL,
`riskmngmt_risk_cause_name` varchar(50) NOT NULL,
`riskmngmt_risk_cause_description` text NOT NULL,
`riskmngmt_risk_cause_probability` smallint(6) NOT NULL,
`riskmngmt_risk_cause_deptartment` int(11) NOT NULL,
`riskmngmt_risk_cause_category` int(11) NOT NULL,
`riskmngmt_risk_cause_risk` int(11) NOT NULL,
PRIMARY KEY (`riskmngmt_risk_cause_id`),
KEY `riskmngmt_risk_cause_deptartment` (`riskmngmt_risk_cause_deptartment`),
KEY `riskmngmt_risk_cause_category` (`riskmngmt_risk_cause_category`),
KEY `riskmngmt_risk_cause_risk` (`riskmngmt_risk_cause_risk`)
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_cause` (
`riskmngmt_cause_id` int(11) NOT NULL,
`riskmngmt_cause_name` varchar(50) NOT NULL,
`riskmngmt_cause_description` text NOT NULL,
`riskmngmt_cause_descriptionRaw` text NOT NULL,
`riskmngmt_cause_probability` smallint(6) NOT NULL,
`riskmngmt_cause_deptartment` int(11) DEFAULT NULL,
`riskmngmt_cause_category` int(11) DEFAULT NULL,
`riskmngmt_cause_risk` int(11) DEFAULT NULL,
PRIMARY KEY (`riskmngmt_cause_id`),
KEY `riskmngmt_cause_deptartment` (`riskmngmt_cause_deptartment`),
KEY `riskmngmt_cause_category` (`riskmngmt_cause_category`),
KEY `riskmngmt_cause_risk` (`riskmngmt_cause_risk`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
)->execute();
$dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_cause`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_cause_ibfk_1` FOREIGN KEY (`riskmngmt_risk_cause_risk`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_risk` (`riskmngmt_risk_id`);'
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_cause`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_cause_ibfk_1` FOREIGN KEY (`riskmngmt_cause_risk`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_risk` (`riskmngmt_risk_id`);'
)->execute();
$dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_solution` (
`riskmngmt_risk_solution_id` int(11) NOT NULL,
`riskmngmt_risk_solution_name` varchar(50) NOT NULL,
`riskmngmt_risk_solution_description` text NOT NULL,
`riskmngmt_risk_solution_probability` smallint(6) NOT NULL,
`riskmngmt_risk_solution_effect` decimal(11,4) NOT NULL,
`riskmngmt_risk_solution_cause` int(11) NOT NULL,
`riskmngmt_risk_solution_risk` int(11) NOT NULL,
PRIMARY KEY (`riskmngmt_risk_solution_id`),
KEY `riskmngmt_risk_solution_cause` (`riskmngmt_risk_solution_cause`),
KEY `riskmngmt_risk_solution_risk` (`riskmngmt_risk_solution_risk`)
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_solution` (
`riskmngmt_solution_id` int(11) NOT NULL,
`riskmngmt_solution_name` varchar(50) NOT NULL,
`riskmngmt_solution_description` text NOT NULL,
`riskmngmt_solution_descriptionRaw` text NOT NULL,
`riskmngmt_solution_probability` smallint(6) NOT NULL,
`riskmngmt_solution_effect` decimal(11,4) DEFAULT NULL,
`riskmngmt_solution_cause` int(11) DEFAULT NULL,
`riskmngmt_solution_risk` int(11) DEFAULT NULL,
PRIMARY KEY (`riskmngmt_solution_id`),
KEY `riskmngmt_solution_cause` (`riskmngmt_solution_cause`),
KEY `riskmngmt_solution_risk` (`riskmngmt_solution_risk`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
)->execute();
$dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_solution`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_solution_ibfk_1` FOREIGN KEY (`riskmngmt_risk_solution_cause`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_cause` (`riskmngmt_risk_cause_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_solution_ibfk_2` FOREIGN KEY (`riskmngmt_risk_solution_risk`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_risk` (`riskmngmt_risk_id`);'
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_solution`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_solution_ibfk_1` FOREIGN KEY (`riskmngmt_solution_cause`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_cause` (`riskmngmt_cause_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_solution_ibfk_2` FOREIGN KEY (`riskmngmt_solution_risk`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_risk` (`riskmngmt_risk_id`);'
)->execute();
break;
}

View File

@ -0,0 +1,109 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
/**
* Risk Management class.
*
* @category Modules
* @package Modules\RiskManagement
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Category
{
private $id = 0;
private $title = '';
private $description = '';
private $descriptionRaw = '';
private $parent = 0;
private $responsible = 0;
private $deputy = 0;
public function __construct()
{
}
public function getId() : int
{
return $this->id;
}
public function getParent()
{
return $this->parent;
}
public function setParent($parent) /* : void */
{
$this->parent = $parent;
}
public function getResponsible()
{
return $this->responsible;
}
public function setResponsible($responsible) /* : void */
{
$this->responsible = $responsible;
}
public function setDeputy($deputy) /* : void */
{
$this->deputy = $deputy;
}
public function getDeputy()
{
return $this->deputy;
}
public function getTitle() : string
{
return $this->title;
}
public function setTitle(string $title)
{
$this->title = $title;
}
public function getDescription() : string
{
return $this->description;
}
public function getDescriptionRaw() : string
{
return $this->descriptionRaw;
}
public function setDescriptionRaw(string $description) /* : void */
{
$this->descriptionRaw = $description;
}
}

123
Models/CategoryMapper.php Normal file
View File

@ -0,0 +1,123 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
use Modules\Media\Models\MediaMapper;
use phpOMS\DataStorage\Database\DataMapperAbstract;
use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\DataStorage\Database\Query\Column;
use phpOMS\DataStorage\Database\RelationType;
class CategoryMapper extends DataMapperAbstract
{
/**
* Columns.
*
* @var array
* @since 1.0.0
*/
protected static $columns = [
'riskmngmt_category_id' => ['name' => 'riskmngmt_category_id', 'type' => 'int', 'internal' => 'id'],
'riskmngmt_category_name' => ['name' => 'riskmngmt_category_name', 'type' => 'string', 'internal' => 'title'],
'riskmngmt_category_description' => ['name' => 'riskmngmt_category_description', 'type' => 'string', 'internal' => 'description'],
'riskmngmt_category_descriptionraw' => ['name' => 'riskmngmt_category_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'],
'riskmngmt_category_parent' => ['name' => 'riskmngmt_category_parent', 'type' => 'int', 'internal' => 'parent'],
'riskmngmt_category_responsible' => ['name' => 'riskmngmt_category_responsible', 'type' => 'int', 'internal' => 'responsible'],
'riskmngmt_category_deputy' => ['name' => 'riskmngmt_category_deputy', 'type' => 'int', 'internal' => 'deputy'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
protected static $table = 'riskmngmt_category';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
protected static $primaryField = 'riskmngmt_category_id';
/**
* Create object.
*
* @param mixed $obj Object
* @param int $relations Behavior for relations creation
*
* @return mixed
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function create($obj, int $relations = RelationType::ALL)
{
try {
$objId = parent::create($obj, $relations);
if($objId === null || !is_scalar($objId)) {
return $objId;
}
$query = new Builder(self::$db);
$query->prefix(self::$db->getPrefix())
->insert(
'account_permission_account',
'account_permission_from',
'account_permission_for',
'account_permission_id1',
'account_permission_id2',
'account_permission_r',
'account_permission_w',
'account_permission_m',
'account_permission_d',
'account_permission_p'
)
->into('account_permission')
->values(1, 'riskmngmt_category', 'riskmngmt_category', 1, $objId, 1, 1, 1, 1, 1);
self::$db->con->prepare($query->toSql())->execute();
} catch (\Exception $e) {
var_dump($e->getMessage());
return false;
}
return $objId;
}
/**
* Get object.
*
* @param mixed $primaryKey Key
* @param int $relations Load relations
* @param mixed $fill Object to fill
*
* @return Cause
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function get($primaryKey, int $relations = RelationType::ALL, $fill = null)
{
return parent::get((int) $primaryKey, $relations, $fill);
}
}

View File

@ -0,0 +1,121 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
/**
* Risk Management class.
*
* @category Modules
* @package Modules\RiskManagement
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Cause
{
private $id = 0;
private $title = '';
private $description = '';
private $descriptionRaw = '';
private $probability = 0.0;
private $department = 0;
private $risk = 0;
private $category = 0;
public function __construct()
{
}
public function getId() : int
{
return $this->id;
}
public function setRisk($risk) /* : void */
{
$this->risk = $risk;
}
public function getRisk()
{
return $this->risk;
}
public function getCategory()
{
return $this->category;
}
public function setCategory($category) /* : void */
{
$this->category = $category;
}
public function getProbability() : float
{
return $this->probability;
}
public function setProbability(float $probability) /* : void */
{
$this->probability = $probability;
}
public function getDepartment()
{
return $this->department;
}
public function setDepartment($department) /* : void */
{
$this->department = $department;
}
public function getTitle() : string
{
return $this->title;
}
public function setTitle(string $title)
{
$this->title = $title;
}
public function getDescription() : string
{
return $this->description;
}
public function getDescriptionRaw() : string
{
return $this->descriptionRaw;
}
public function setDescriptionRaw(string $description) /* : void */
{
$this->descriptionRaw = $description;
}
}

123
Models/CauseMapper.php Normal file
View File

@ -0,0 +1,123 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
use phpOMS\DataStorage\Database\DataMapperAbstract;
use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\DataStorage\Database\Query\Column;
use phpOMS\DataStorage\Database\RelationType;
class CauseMapper extends DataMapperAbstract
{
/**
* Columns.
*
* @var array
* @since 1.0.0
*/
protected static $columns = [
'riskmngmt_cause_id' => ['name' => 'riskmngmt_cause_id', 'type' => 'int', 'internal' => 'id'],
'riskmngmt_cause_name' => ['name' => 'riskmngmt_cause_name', 'type' => 'string', 'internal' => 'title'],
'riskmngmt_cause_description' => ['name' => 'riskmngmt_cause_description', 'type' => 'string', 'internal' => 'description'],
'riskmngmt_cause_descriptionraw' => ['name' => 'riskmngmt_cause_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'],
'riskmngmt_cause_department' => ['name' => 'riskmngmt_cause_department', 'type' => 'string', 'internal' => 'department'],
'riskmngmt_cause_category' => ['name' => 'riskmngmt_cause_category', 'type' => 'string', 'internal' => 'category'],
'riskmngmt_cause_risk' => ['name' => 'riskmngmt_cause_risk', 'type' => 'string', 'internal' => 'risk'],
'riskmngmt_cause_probability' => ['name' => 'riskmngmt_cause_probability', 'type' => 'int', 'internal' => 'probability'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
protected static $table = 'riskmngmt_cause';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
protected static $primaryField = 'riskmngmt_cause_id';
/**
* Create object.
*
* @param mixed $obj Object
* @param int $relations Behavior for relations creation
*
* @return mixed
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function create($obj, int $relations = RelationType::ALL)
{
try {
$objId = parent::create($obj, $relations);
if($objId === null || !is_scalar($objId)) {
return $objId;
}
$query = new Builder(self::$db);
$query->prefix(self::$db->getPrefix())
->insert(
'account_permission_account',
'account_permission_from',
'account_permission_for',
'account_permission_id1',
'account_permission_id2',
'account_permission_r',
'account_permission_w',
'account_permission_m',
'account_permission_d',
'account_permission_p'
)
->into('account_permission')
->values(1, 'riskmngmt_cause', 'riskmngmt_cause', 1, $objId, 1, 1, 1, 1, 1);
self::$db->con->prepare($query->toSql())->execute();
} catch (\Exception $e) {
var_dump($e->getMessage());
return false;
}
return $objId;
}
/**
* Get object.
*
* @param mixed $primaryKey Key
* @param int $relations Load relations
* @param mixed $fill Object to fill
*
* @return Cause
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function get($primaryKey, int $relations = RelationType::ALL, $fill = null)
{
return parent::get((int) $primaryKey, $relations, $fill);
}
}

78
Models/Department.php Normal file
View File

@ -0,0 +1,78 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
/**
* Risk Management class.
*
* @category Modules
* @package Modules\RiskManagement
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Department
{
private $id = 0;
private $department = 0;
private $responsible = 0;
private $deputy = 0;
public function __construct()
{
}
public function getId() : int
{
return $this->id;
}
public function getDepartment()
{
return $this->department;
}
public function setDepartment($department)
{
$this->department = $department;
}
public function getResponsible()
{
return $this->responsible;
}
public function setResponsible($responsible) /* : void */
{
$this->responsible = $responsible;
}
public function getDeputy()
{
return $this->deputy;
}
public function setDeputy($deputy) /* : void */
{
$this->deputy = $deputy;
}
}

133
Models/DepartmentMapper.php Normal file
View File

@ -0,0 +1,133 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
use Modules\Media\Models\MediaMapper;
use phpOMS\DataStorage\Database\DataMapperAbstract;
use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\DataStorage\Database\Query\Column;
use phpOMS\DataStorage\Database\RelationType;
class DepartmentMapper extends DataMapperAbstract
{
/**
* Columns.
*
* @var array
* @since 1.0.0
*/
protected static $columns = [
'riskmngmt_department_id' => ['name' => 'riskmngmt_department_id', 'type' => 'int', 'internal' => 'id'],
'riskmngmt_department_department' => ['name' => 'riskmngmt_department_department', 'type' => 'int', 'internal' => 'project'],
'riskmngmt_department_responsible' => ['name' => 'riskmngmt_department_responsible', 'type' => 'int', 'internal' => 'responsible'],
'riskmngmt_department_deputy' => ['name' => 'riskmngmt_department_deputy', 'type' => 'int', 'internal' => 'deputy'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
protected static $table = 'riskmngmt_department';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
protected static $primaryField = 'riskmngmt_department_id';
/**
* Has one relation.
*
* @var array
* @since 1.0.0
*/
protected static $ownsOne = [
'source' => [
'mapper' => \Modules\Organization\Models\DepartmentMapper::class,
'src' => 'riskmngmt_department_department',
],
];
/**
* Create object.
*
* @param mixed $obj Object
* @param int $relations Behavior for relations creation
*
* @return mixed
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function create($obj, int $relations = RelationType::ALL)
{
try {
$objId = parent::create($obj, $relations);
if($objId === null || !is_scalar($objId)) {
return $objId;
}
$query = new Builder(self::$db);
$query->prefix(self::$db->getPrefix())
->insert(
'account_permission_account',
'account_permission_from',
'account_permission_for',
'account_permission_id1',
'account_permission_id2',
'account_permission_r',
'account_permission_w',
'account_permission_m',
'account_permission_d',
'account_permission_p'
)
->into('account_permission')
->values(1, 'riskmngmt_department', 'riskmngmt_department', 1, $objId, 1, 1, 1, 1, 1);
self::$db->con->prepare($query->toSql())->execute();
} catch (\Exception $e) {
var_dump($e->getMessage());
return false;
}
return $objId;
}
/**
* Get object.
*
* @param mixed $primaryKey Key
* @param int $relations Load relations
* @param mixed $fill Object to fill
*
* @return Cause
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function get($primaryKey, int $relations = RelationType::ALL, $fill = null)
{
return parent::get((int) $primaryKey, $relations, $fill);
}
}

32
Models/NullCategory.php Normal file
View File

@ -0,0 +1,32 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
/**
* Risk Management class.
*
* @category Modules
* @package Modules\RiskManagement
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class NullCategory extends Category
{
}

32
Models/NullCause.php Normal file
View File

@ -0,0 +1,32 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
/**
* Risk Management class.
*
* @category Modules
* @package Modules\RiskManagement
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class NullCause extends Cause
{
}

32
Models/NullDepartment.php Normal file
View File

@ -0,0 +1,32 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
/**
* Risk Management class.
*
* @category Modules
* @package Modules\RiskManagement
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class NullDepartment extends Department
{
}

32
Models/NullProcess.php Normal file
View File

@ -0,0 +1,32 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
/**
* Risk Management class.
*
* @category Modules
* @package Modules\RiskManagement
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class NullProcess extends Process
{
}

32
Models/NullProject.php Normal file
View File

@ -0,0 +1,32 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
/**
* Risk Management class.
*
* @category Modules
* @package Modules\RiskManagement
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class NullProject extends Project
{
}

32
Models/NullRisk.php Normal file
View File

@ -0,0 +1,32 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
/**
* Risk Management class.
*
* @category Modules
* @package Modules\RiskManagement
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class NullRisk extends Risk
{
}

32
Models/NullRiskObject.php Normal file
View File

@ -0,0 +1,32 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
/**
* Risk Management class.
*
* @category Modules
* @package Modules\RiskManagement
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class NullRiskObject extends RiskObject
{
}

32
Models/NullSolution.php Normal file
View File

@ -0,0 +1,32 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
/**
* Risk Management class.
*
* @category Modules
* @package Modules\RiskManagement
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class NullSolution extends Solution
{
}

111
Models/Process.php Normal file
View File

@ -0,0 +1,111 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
/**
* Risk Management class.
*
* @category Modules
* @package Modules\RiskManagement
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Process
{
private $id = 0;
private $title = '';
private $description = '';
private $descriptionRaw = '';
private $department = 0;
private $responsible = 0;
private $deputy = 0;
private $unit = 0;
public function __construct()
{
}
public function getId() : int
{
return $this->id;
}
public function getTitle() : string
{
return $this->title;
}
public function setTitle(string $title)
{
$this->title = $title;
}
public function getDescription() : string
{
return $this->description;
}
public function getDescriptionRaw() : string
{
return $this->descriptionRaw;
}
public function setDescriptionRaw(string $description) /* : void */
{
$this->descriptionRaw = $description;
}
public function getUnit()
{
return $this->unit;
}
public function setUnit($unit)
{
$this->unit = $unit;
}
public function getResponsible()
{
return $this->responsible;
}
public function setResponsible($responsible) /* : void */
{
$this->responsible = $responsible;
}
public function getDeputy()
{
return $this->deputy;
}
public function setDeputy($deputy) /* : void */
{
$this->deputy = $deputy;
}
}

123
Models/ProcessMapper.php Normal file
View File

@ -0,0 +1,123 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
use Modules\Media\Models\MediaMapper;
use phpOMS\DataStorage\Database\DataMapperAbstract;
use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\DataStorage\Database\Query\Column;
use phpOMS\DataStorage\Database\RelationType;
class ProcessMapper extends DataMapperAbstract
{
/**
* Columns.
*
* @var array
* @since 1.0.0
*/
protected static $columns = [
'riskmngmt_process_id' => ['name' => 'riskmngmt_process_id', 'type' => 'int', 'internal' => 'id'],
'riskmngmt_process_name' => ['name' => 'riskmngmt_process_name', 'type' => 'string', 'internal' => 'title'],
'riskmngmt_process_description' => ['name' => 'riskmngmt_process_description', 'type' => 'string', 'internal' => 'description'],
'riskmngmt_process_descriptionraw' => ['name' => 'riskmngmt_process_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'],
'riskmngmt_process_unit' => ['name' => 'riskmngmt_process_unit', 'type' => 'int', 'internal' => 'unit'],
'riskmngmt_process_responsible' => ['name' => 'riskmngmt_process_responsible', 'type' => 'int', 'internal' => 'responsible'],
'riskmngmt_process_deputy' => ['name' => 'riskmngmt_process_deputy', 'type' => 'int', 'internal' => 'deputy'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
protected static $table = 'riskmngmt_process';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
protected static $primaryField = 'riskmngmt_process_id';
/**
* Create object.
*
* @param mixed $obj Object
* @param int $relations Behavior for relations creation
*
* @return mixed
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function create($obj, int $relations = RelationType::ALL)
{
try {
$objId = parent::create($obj, $relations);
if($objId === null || !is_scalar($objId)) {
return $objId;
}
$query = new Builder(self::$db);
$query->prefix(self::$db->getPrefix())
->insert(
'account_permission_account',
'account_permission_from',
'account_permission_for',
'account_permission_id1',
'account_permission_id2',
'account_permission_r',
'account_permission_w',
'account_permission_m',
'account_permission_d',
'account_permission_p'
)
->into('account_permission')
->values(1, 'riskmngmt_process', 'riskmngmt_process', 1, $objId, 1, 1, 1, 1, 1);
self::$db->con->prepare($query->toSql())->execute();
} catch (\Exception $e) {
var_dump($e->getMessage());
return false;
}
return $objId;
}
/**
* Get object.
*
* @param mixed $primaryKey Key
* @param int $relations Load relations
* @param mixed $fill Object to fill
*
* @return Cause
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function get($primaryKey, int $relations = RelationType::ALL, $fill = null)
{
return parent::get((int) $primaryKey, $relations, $fill);
}
}

78
Models/Project.php Normal file
View File

@ -0,0 +1,78 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
/**
* Risk Management class.
*
* @category Modules
* @package Modules\RiskManagement
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Project
{
private $id = 0;
private $project = 0;
private $responsible = 0;
private $deputy = 0;
public function __construct()
{
}
public function getId() : int
{
return $this->id;
}
public function getProject()
{
return $this->project;
}
public function setProject(string $project)
{
$this->project = $project;
}
public function getResponsible()
{
return $this->responsible;
}
public function setResponsible($responsible) /* : void */
{
$this->responsible = $responsible;
}
public function getDeputy()
{
return $this->deputy;
}
public function setDeputy($deputy) /* : void */
{
$this->deputy = $deputy;
}
}

133
Models/ProjectMapper.php Normal file
View File

@ -0,0 +1,133 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
use Modules\Media\Models\MediaMapper;
use phpOMS\DataStorage\Database\DataMapperAbstract;
use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\DataStorage\Database\Query\Column;
use phpOMS\DataStorage\Database\RelationType;
class ProjectMapper extends DataMapperAbstract
{
/**
* Columns.
*
* @var array
* @since 1.0.0
*/
protected static $columns = [
'riskmngmt_project_id' => ['name' => 'riskmngmt_project_id', 'type' => 'int', 'internal' => 'id'],
'riskmngmt_project_project' => ['name' => 'riskmngmt_project_project', 'type' => 'int', 'internal' => 'project'],
'riskmngmt_project_responsible' => ['name' => 'riskmngmt_project_responsible', 'type' => 'int', 'internal' => 'responsible'],
'riskmngmt_project_deputy' => ['name' => 'riskmngmt_project_deputy', 'type' => 'int', 'internal' => 'deputy'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
protected static $table = 'riskmngmt_project';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
protected static $primaryField = 'riskmngmt_project_id';
/**
* Has one relation.
*
* @var array
* @since 1.0.0
*/
protected static $ownsOne = [
'source' => [
'mapper' => \Modules\ProjectManagement\Models\ProjectMapper::class,
'src' => 'riskmngmt_project_project',
],
];
/**
* Create object.
*
* @param mixed $obj Object
* @param int $relations Behavior for relations creation
*
* @return mixed
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function create($obj, int $relations = RelationType::ALL)
{
try {
$objId = parent::create($obj, $relations);
if($objId === null || !is_scalar($objId)) {
return $objId;
}
$query = new Builder(self::$db);
$query->prefix(self::$db->getPrefix())
->insert(
'account_permission_account',
'account_permission_from',
'account_permission_for',
'account_permission_id1',
'account_permission_id2',
'account_permission_r',
'account_permission_w',
'account_permission_m',
'account_permission_d',
'account_permission_p'
)
->into('account_permission')
->values(1, 'riskmngmt_project', 'riskmngmt_project', 1, $objId, 1, 1, 1, 1, 1);
self::$db->con->prepare($query->toSql())->execute();
} catch (\Exception $e) {
var_dump($e->getMessage());
return false;
}
return $objId;
}
/**
* Get object.
*
* @param mixed $primaryKey Key
* @param int $relations Load relations
* @param mixed $fill Object to fill
*
* @return Cause
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function get($primaryKey, int $relations = RelationType::ALL, $fill = null)
{
return parent::get((int) $primaryKey, $relations, $fill);
}
}

View File

@ -35,6 +35,8 @@ class Risk
private $description = '';
private $descriptionRaw = '';
private $unit = 0;
private $department = 0;
@ -45,7 +47,7 @@ class Risk
private $process = 0;
private $responseible = 0;
private $responsible = 0;
private $deputy = 0;
@ -61,7 +63,6 @@ class Risk
public function __construct()
{
}
public function getId() : int
@ -134,9 +135,14 @@ class Risk
return $this->description;
}
public function setDescription(string $description) /* : void */
public function setDescriptionRaw(string $description) /* : void */
{
$this->description = $description;
$this->descriptionRaw = $description;
}
public function getDescriptionRaw() : string
{
return $this->descriptionRaw;
}
public function getUnit()
@ -196,7 +202,7 @@ class Risk
public function setResponsible() /* : void */
{
$this->responsible = $responseible;
$this->responsible = $responsible;
}
public function getDeputy()

158
Models/RiskMapper.php Normal file
View File

@ -0,0 +1,158 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
use Modules\Media\Models\MediaMapper;
use Modules\RiskManagement\Models\RiskObject;
use phpOMS\DataStorage\Database\DataMapperAbstract;
use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\DataStorage\Database\Query\Column;
use phpOMS\DataStorage\Database\RelationType;
class RiskMapper extends DataMapperAbstract
{
/**
* Columns.
*
* @var array
* @since 1.0.0
*/
protected static $columns = [
'riskmngmt_risk_id' => ['name' => 'riskmngmt_risk_id', 'type' => 'int', 'internal' => 'id'],
'riskmngmt_risk_name' => ['name' => 'riskmngmt_risk_name', 'type' => 'string', 'internal' => 'name'],
'riskmngmt_risk_description' => ['name' => 'riskmngmt_risk_description', 'type' => 'string', 'internal' => 'description'],
'riskmngmt_risk_descriptionraw' => ['name' => 'riskmngmt_risk_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'],
'riskmngmt_risk_created_at' => ['name' => 'riskmngmt_risk_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
'riskmngmt_risk_unit' => ['name' => 'riskmngmt_risk_unit', 'type' => 'int', 'internal' => 'unit'],
'riskmngmt_risk_department' => ['name' => 'riskmngmt_risk_department', 'type' => 'int', 'internal' => 'department'],
'riskmngmt_risk_category' => ['name' => 'riskmngmt_risk_category', 'type' => 'int', 'internal' => 'category'],
'riskmngmt_risk_project' => ['name' => 'riskmngmt_risk_project', 'type' => 'int', 'internal' => 'project'],
'riskmngmt_risk_process' => ['name' => 'riskmngmt_risk_process', 'type' => 'int', 'internal' => 'process'],
'riskmngmt_risk_responsible' => ['name' => 'riskmngmt_risk_responsible', 'type' => 'int', 'internal' => 'responsible'],
'riskmngmt_risk_deputy' => ['name' => 'riskmngmt_risk_deputy', 'type' => 'int', 'internal' => 'deputy'],
];
/**
* Has many relation.
*
* @var array
* @since 1.0.0
*/
protected static $hasMany = [
'media' => [
'mapper' => MediaMapper::class,
'table' => 'riskmngmt_risk_media',
'dst' => 'riskmngmt_risk_media_media',
'src' => 'riskmngmt_risk_media_risk',
],
'riskObjects' => [
'mapper' => RiskObject::class,
'table' => 'riskmngmt_risk_object',
'dst' => 'riskmngmt_risk_object_risk',
'src' => null,
],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
protected static $table = 'riskmngmt_risk';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
protected static $primaryField = 'riskmngmt_risk_id';
/**
* Created at column
*
* @var string
* @since 1.0.0
*/
protected static $createdAt = 'riskmngmt_risk_created_at';
/**
* Create object.
*
* @param mixed $obj Object
* @param int $relations Behavior for relations creation
*
* @return mixed
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function create($obj, int $relations = RelationType::ALL)
{
try {
$objId = parent::create($obj, $relations);
if($objId === null || !is_scalar($objId)) {
return $objId;
}
$query = new Builder(self::$db);
$query->prefix(self::$db->getPrefix())
->insert(
'account_permission_account',
'account_permission_from',
'account_permission_for',
'account_permission_id1',
'account_permission_id2',
'account_permission_r',
'account_permission_w',
'account_permission_m',
'account_permission_d',
'account_permission_p'
)
->into('account_permission')
->values(1, 'riskmngmt_risk', 'riskmngmt_risk', 1, $objId, 1, 1, 1, 1, 1);
self::$db->con->prepare($query->toSql())->execute();
} catch (\Exception $e) {
var_dump($e->getMessage());
return false;
}
return $objId;
}
/**
* Get object.
*
* @param mixed $primaryKey Key
* @param int $relations Load relations
* @param mixed $fill Object to fill
*
* @return supplier
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function get($primaryKey, int $relations = RelationType::ALL, $fill = null)
{
return parent::get((int) $primaryKey, $relations, $fill);
}
}

View File

@ -0,0 +1,85 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
/**
* Risk Management class.
*
* @category Modules
* @package Modules\RiskManagement
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class RiskObject
{
private $id = 0;
private $title = '';
private $description = '';
private $descriptionRaw = '';
private $risk = 0;
public function __construct()
{
}
public function getId() : int
{
return $this->id;
}
public function getRisk()
{
return $this->risk;
}
public function setRisk($risk) /* : void */
{
$this->risk = $risk;
}
public function getTitle() : string
{
return $this->title;
}
public function setTitle(string $title) /* : void */
{
$this->title = $title;
}
public function getDescription() : string
{
return $this->description;
}
public function getDescriptionRaw() : string
{
return $this->descriptionRaw;
}
public function setDescriptionRaw(string $description) /* : void */
{
$this->descriptionRaw = $description;
}
}

122
Models/RiskObjectMapper.php Normal file
View File

@ -0,0 +1,122 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
use Modules\Media\Models\MediaMapper;
use Modules\RiskManagement\Models\Risk;
use phpOMS\DataStorage\Database\DataMapperAbstract;
use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\DataStorage\Database\Query\Column;
use phpOMS\DataStorage\Database\RelationType;
class RiskObjectMapper extends DataMapperAbstract
{
/**
* Columns.
*
* @var array
* @since 1.0.0
*/
protected static $columns = [
'riskmngmt_risk_object_id' => ['name' => 'riskmngmt_risk_object_id', 'type' => 'int', 'internal' => 'id'],
'riskmngmt_risk_object_name' => ['name' => 'riskmngmt_risk_object_name', 'type' => 'string', 'internal' => 'title'],
'riskmngmt_risk_object_description' => ['name' => 'riskmngmt_risk_object_description', 'type' => 'string', 'internal' => 'description'],
'riskmngmt_risk_object_descriptionraw' => ['name' => 'riskmngmt_risk_object_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'],
'riskmngmt_risk_object_risk' => ['name' => 'riskmngmt_risk_object_risk', 'type' => 'int', 'internal' => 'risk'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
protected static $table = 'riskmngmt_risk_object';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
protected static $primaryField = 'riskmngmt_risk_object_id';
/**
* Create object.
*
* @param mixed $obj Object
* @param int $relations Behavior for relations creation
*
* @return mixed
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function create($obj, int $relations = RelationType::ALL)
{
try {
$objId = parent::create($obj, $relations);
if($objId === null || !is_scalar($objId)) {
return $objId;
}
$query = new Builder(self::$db);
$query->prefix(self::$db->getPrefix())
->insert(
'account_permission_account',
'account_permission_from',
'account_permission_for',
'account_permission_id1',
'account_permission_id2',
'account_permission_r',
'account_permission_w',
'account_permission_m',
'account_permission_d',
'account_permission_p'
)
->into('account_permission')
->values(1, 'riskmngmt_risk_object', 'riskmngmt_risk_object', 1, $objId, 1, 1, 1, 1, 1);
self::$db->con->prepare($query->toSql())->execute();
} catch (\Exception $e) {
var_dump($e->getMessage());
return false;
}
return $objId;
}
/**
* Get object.
*
* @param mixed $primaryKey Key
* @param int $relations Load relations
* @param mixed $fill Object to fill
*
* @return Cause
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function get($primaryKey, int $relations = RelationType::ALL, $fill = null)
{
return parent::get((int) $primaryKey, $relations, $fill);
}
}

View File

@ -0,0 +1,109 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
/**
* Risk Management class.
*
* @category Modules
* @package Modules\RiskManagement
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Solution
{
private $id = 0;
private $title = '';
private $description = '';
private $descriptionRaw = '';
private $probability = 0.0;
private $cause = 0;
private $risk = 0;
public function __construct()
{
}
public function getId() : int
{
return $this->id;
}
public function setRisk($risk) /* : void */
{
$this->risk = $risk;
}
public function getRisk()
{
return $this->risk;
}
public function setCause($cause) /* : void */
{
$this->cause = $cause;
}
public function getCause()
{
return $this->cause;
}
public function getProbability() : float
{
return $this->probability;
}
public function setProbability(float $probability) /* : void */
{
$this->probability = $probability;
}
public function getTitle() : string
{
return $this->title;
}
public function setTitle(string $title)
{
$this->title = $title;
}
public function getDescription() : string
{
return $this->description;
}
public function getDescriptionRaw() : string
{
return $this->descriptionRaw;
}
public function setDescriptionRaw(string $description) /* : void */
{
$this->descriptionRaw = $description;
}
}

123
Models/SolutionMapper.php Normal file
View File

@ -0,0 +1,123 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace Modules\RiskManagement\Models;
use Modules\Media\Models\MediaMapper;
use phpOMS\DataStorage\Database\DataMapperAbstract;
use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\DataStorage\Database\Query\Column;
use phpOMS\DataStorage\Database\RelationType;
class SolutionMapper extends DataMapperAbstract
{
/**
* Columns.
*
* @var array
* @since 1.0.0
*/
protected static $columns = [
'riskmngmt_solution_id' => ['name' => 'riskmngmt_solution_id', 'type' => 'int', 'internal' => 'id'],
'riskmngmt_solution_name' => ['name' => 'riskmngmt_solution_name', 'type' => 'string', 'internal' => 'title'],
'riskmngmt_solution_description' => ['name' => 'riskmngmt_solution_description', 'type' => 'string', 'internal' => 'description'],
'riskmngmt_solution_descriptionraw' => ['name' => 'riskmngmt_solution_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'],
'riskmngmt_solution_probability' => ['name' => 'riskmngmt_solution_probability', 'type' => 'int', 'internal' => 'probability'],
'riskmngmt_solution_cause' => ['name' => 'riskmngmt_solution_cause', 'type' => 'int', 'internal' => 'cause'],
'riskmngmt_solution_risk' => ['name' => 'riskmngmt_solution_risk', 'type' => 'int', 'internal' => 'risk'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
protected static $table = 'riskmngmt_solution';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
protected static $primaryField = 'riskmngmt_solution_id';
/**
* Create object.
*
* @param mixed $obj Object
* @param int $relations Behavior for relations creation
*
* @return mixed
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function create($obj, int $relations = RelationType::ALL)
{
try {
$objId = parent::create($obj, $relations);
if($objId === null || !is_scalar($objId)) {
return $objId;
}
$query = new Builder(self::$db);
$query->prefix(self::$db->getPrefix())
->insert(
'account_permission_account',
'account_permission_from',
'account_permission_for',
'account_permission_id1',
'account_permission_id2',
'account_permission_r',
'account_permission_w',
'account_permission_m',
'account_permission_d',
'account_permission_p'
)
->into('account_permission')
->values(1, 'riskmngmt_solution', 'riskmngmt_solution', 1, $objId, 1, 1, 1, 1, 1);
self::$db->con->prepare($query->toSql())->execute();
} catch (\Exception $e) {
var_dump($e->getMessage());
return false;
}
return $objId;
}
/**
* Get object.
*
* @param mixed $primaryKey Key
* @param int $relations Load relations
* @param mixed $fill Object to fill
*
* @return Cause
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function get($primaryKey, int $relations = RelationType::ALL, $fill = null)
{
return parent::get((int) $primaryKey, $relations, $fill);
}
}

View File

@ -16,7 +16,9 @@
},
"description": "Risk Management module.",
"directory": "RiskManagement",
"dependencies": {},
"dependencies": {
"Media": "*"
},
"providing": {
"Navigation": "*"
},