mirror of
https://github.com/Karaka-Management/oms-Calendar.git
synced 2026-02-15 16:08:41 +00:00
Modifying and adding calendar mapper/models
This commit is contained in:
parent
7d02549bcc
commit
cf51115707
|
|
@ -48,16 +48,16 @@ class Installer extends InstallerAbstract
|
||||||
`calendar_name` varchar(25) NOT NULL,
|
`calendar_name` varchar(25) NOT NULL,
|
||||||
`calendar_password` varchar(64) NOT NULL,
|
`calendar_password` varchar(64) NOT NULL,
|
||||||
`calendar_description` varchar(255) NOT NULL,
|
`calendar_description` varchar(255) NOT NULL,
|
||||||
`calendar_creator` int(11) NOT NULL,
|
`task_created_by` int(11) NOT NULL,
|
||||||
`calendar_created` datetime NOT NULL,
|
`task_created_at` datetime NOT NULL,
|
||||||
PRIMARY KEY (`calendar_id`),
|
PRIMARY KEY (`calendar_id`),
|
||||||
KEY `calendar_creator` (`calendar_creator`)
|
KEY `task_created_by` (`task_created_by`)
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||||
)->execute();
|
)->execute();
|
||||||
|
|
||||||
$dbPool->get('core')->con->prepare(
|
$dbPool->get('core')->con->prepare(
|
||||||
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'calendar`
|
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'calendar`
|
||||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_ibfk_1` FOREIGN KEY (`calendar_creator`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
|
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_ibfk_1` FOREIGN KEY (`task_created_by`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
|
||||||
)->execute();
|
)->execute();
|
||||||
|
|
||||||
$dbPool->get('core')->con->prepare(
|
$dbPool->get('core')->con->prepare(
|
||||||
|
|
@ -82,30 +82,20 @@ class Installer extends InstallerAbstract
|
||||||
`calendar_event_id` int(11) NOT NULL AUTO_INCREMENT,
|
`calendar_event_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`calendar_event_name` varchar(25) NOT NULL,
|
`calendar_event_name` varchar(25) NOT NULL,
|
||||||
`calendar_event_description` varchar(255) NOT NULL,
|
`calendar_event_description` varchar(255) NOT NULL,
|
||||||
`calendar_event_start` datetime NOT NULL,
|
|
||||||
`calendar_event_end` datetime NOT NULL,
|
|
||||||
`calendar_event_status` tinyint(1) NOT NULL,
|
`calendar_event_status` tinyint(1) NOT NULL,
|
||||||
`calendar_event_repeat` tinyint(1) NOT NULL,
|
`calendar_event_location` varchar(511) NOT NULL,
|
||||||
`calendar_event_rep_interval` tinyint(3) NOT NULL,
|
`calendar_event_created_by` int(11) NOT NULL,
|
||||||
`calendar_event_rep_monday` tinyint(1) NOT NULL,
|
`calendar_event_created_at` datetime NOT NULL,
|
||||||
`calendar_event_rep_tuesday` tinyint(1) NOT NULL,
|
|
||||||
`calendar_event_rep_wednesday` tinyint(1) NOT NULL,
|
|
||||||
`calendar_event_rep_thursday` tinyint(1) NOT NULL,
|
|
||||||
`calendar_event_rep_friday` tinyint(1) NOT NULL,
|
|
||||||
`calendar_event_rep_saturday` tinyint(1) NOT NULL,
|
|
||||||
`calendar_event_rep_sunday` tinyint(1) NOT NULL,
|
|
||||||
`calendar_event_creator` int(11) NOT NULL,
|
|
||||||
`calendar_event_created` datetime NOT NULL,
|
|
||||||
`calendar_event_calendar` int(11) NOT NULL,
|
`calendar_event_calendar` int(11) NOT NULL,
|
||||||
PRIMARY KEY (`calendar_event_id`),
|
PRIMARY KEY (`calendar_event_id`),
|
||||||
KEY `calendar_event_creator` (`calendar_event_creator`),
|
KEY `calendar_event_created_by` (`calendar_event_created_by`),
|
||||||
KEY `calendar_event_calendar` (`calendar_event_calendar`)
|
KEY `calendar_event_calendar` (`calendar_event_calendar`)
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||||
)->execute();
|
)->execute();
|
||||||
|
|
||||||
$dbPool->get('core')->con->prepare(
|
$dbPool->get('core')->con->prepare(
|
||||||
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'calendar_event`
|
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'calendar_event`
|
||||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_event_ibfk_1` FOREIGN KEY (`calendar_event_creator`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`),
|
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_event_ibfk_1` FOREIGN KEY (`calendar_event_created_by`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`),
|
||||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_event_ibfk_2` FOREIGN KEY (`calendar_event_calendar`) REFERENCES `' . $dbPool->get('core')->prefix . 'calendar` (`calendar_id`);'
|
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_event_ibfk_2` FOREIGN KEY (`calendar_event_calendar`) REFERENCES `' . $dbPool->get('core')->prefix . 'calendar` (`calendar_id`);'
|
||||||
)->execute();
|
)->execute();
|
||||||
|
|
||||||
|
|
|
||||||
127
Models/CalendarMapper.php
Normal file
127
Models/CalendarMapper.php
Normal file
|
|
@ -0,0 +1,127 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.0
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright 2013 Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
namespace Modules\Calendar\Models;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Builder;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Column;
|
||||||
|
|
||||||
|
class CalendarMapper extends DataMapperAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Columns.
|
||||||
|
*
|
||||||
|
* @var array<string, array>
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $columns = [
|
||||||
|
'calendar_id' => ['name' => 'calendar_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
|
'calendar_name' => ['name' => 'calendar_name', 'type' => 'string', 'internal' => 'name'],
|
||||||
|
'calendar_password' => ['name' => 'calendar_password', 'type' => 'string', 'internal' => 'password'],
|
||||||
|
'calendar_description' => ['name' => 'calendar_description', 'type' => 'int', 'internal' => 'description'],
|
||||||
|
'calendar_created_by' => ['name' => 'calendar_created_by', 'type' => 'int', 'internal' => 'createdBy'],
|
||||||
|
'calendar_created_at' => ['name' => 'calendar_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
|
||||||
|
];
|
||||||
|
|
||||||
|
protected static $hasMany = [
|
||||||
|
'taskElements' => [
|
||||||
|
'mapper' => '\Modules\Calendar\Models\EventMapper',
|
||||||
|
'relationmapper' => '\Modules\Calendar\Models\EventMapper',
|
||||||
|
'table' => 'calendar_event',
|
||||||
|
'dst' => 'calendar_event_calendar',
|
||||||
|
'src' => null,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $table = 'calendar';
|
||||||
|
|
||||||
|
protected static $createdAt = 'calendar_created_at';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary field name.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $primaryField = 'calendar_id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create media.
|
||||||
|
*
|
||||||
|
* @param Calendar $obj Media
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public function create($obj)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$objId = parent::create($obj);
|
||||||
|
$query = new Builder($this->db);
|
||||||
|
$query->prefix($this->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($obj->getCreatedBy(), 'calendar', 'calendar', 1, $objId, 1, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
$this->db->con->prepare($query->toSql())->execute();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find.
|
||||||
|
*
|
||||||
|
* @param array $columns Columns to select
|
||||||
|
*
|
||||||
|
* @return Builder
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public function find(...$columns) : Builder
|
||||||
|
{
|
||||||
|
return parent::find(...$columns)->from('account_permission')
|
||||||
|
->where('account_permission.account_permission_for', '=', 'task')
|
||||||
|
->where('account_permission.account_permission_id1', '=', 1)
|
||||||
|
->where('task.task_id', '=', new Column('account_permission.account_permission_id2'))
|
||||||
|
->where('account_permission.account_permission_r', '=', 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
157
Models/Event.php
157
Models/Event.php
|
|
@ -15,6 +15,10 @@
|
||||||
*/
|
*/
|
||||||
namespace Modules\Calendar\Models;
|
namespace Modules\Calendar\Models;
|
||||||
|
|
||||||
|
use phpOMS\Account\Account;
|
||||||
|
use phpOMS\Account\NullAccount;
|
||||||
|
use phpOMS\Datatypes\Location;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calendar class.
|
* Calendar class.
|
||||||
*
|
*
|
||||||
|
|
@ -59,7 +63,7 @@ class Event
|
||||||
* @var \Datetime
|
* @var \Datetime
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private $created = null;
|
private $createdAt = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creator.
|
* Creator.
|
||||||
|
|
@ -67,7 +71,7 @@ class Event
|
||||||
* @var int
|
* @var int
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private $creator = null;
|
private $createdBy = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* People.
|
* People.
|
||||||
|
|
@ -77,6 +81,8 @@ class Event
|
||||||
*/
|
*/
|
||||||
private $location = null;
|
private $location = null;
|
||||||
|
|
||||||
|
private $calendar = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* People.
|
* People.
|
||||||
*
|
*
|
||||||
|
|
@ -85,133 +91,116 @@ class Event
|
||||||
*/
|
*/
|
||||||
private $people = [];
|
private $people = [];
|
||||||
|
|
||||||
/**
|
|
||||||
* Start.
|
|
||||||
*
|
|
||||||
* @var \Datetime
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $start = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start.
|
|
||||||
*
|
|
||||||
* @var \Datetime
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $end = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Timezone.
|
|
||||||
*
|
|
||||||
* @var \Datetime
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $timezone = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Occurence.
|
|
||||||
*
|
|
||||||
* @var \Modules\Calendar\Models\OccurrenceType
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $occurence = null;
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
$this->createdAt = new \DateTime('now');
|
||||||
|
$this->location = new Location();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getId() : int
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function init($id)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function __clone()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getId()
|
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName()
|
public function getName() : string
|
||||||
{
|
{
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setName($name)
|
public function getPeople() : array
|
||||||
|
{
|
||||||
|
return $this->people;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPerson(int $id) : Account
|
||||||
|
{
|
||||||
|
return $this->people[$id] ?? new NullAccount();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addPerson(Account $person)
|
||||||
|
{
|
||||||
|
$this->people[] = $person;
|
||||||
|
|
||||||
|
end($this->people);
|
||||||
|
$key = key($this->people);
|
||||||
|
reset($this->people);
|
||||||
|
|
||||||
|
return $key;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove Element from list.
|
||||||
|
*
|
||||||
|
* @param int $id Task element
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public function removePerson(int $id) : bool
|
||||||
|
{
|
||||||
|
if (isset($this->people[$id])) {
|
||||||
|
unset($this->people[$id]);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setName(string $name)
|
||||||
{
|
{
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDescription()
|
public function getDescription() : string
|
||||||
{
|
{
|
||||||
return $this->description;
|
return $this->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setDescription($desc)
|
public function setDescription(string $desc)
|
||||||
{
|
{
|
||||||
$this->description = $desc;
|
$this->description = $desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCreated()
|
public function getCreatedAt() : \DateTime
|
||||||
{
|
{
|
||||||
return $this->created;
|
return $this->createdAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCreated($created)
|
public function setCreatedAt(\DateTime $createdAt)
|
||||||
{
|
{
|
||||||
$this->created = $created;
|
$this->createdAt = $createdAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCreator()
|
public function getCreatedBy() : int
|
||||||
{
|
{
|
||||||
return $this->creator;
|
return $this->createdBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCreator($creator)
|
public function setCreatedBy(int $createdBy)
|
||||||
{
|
{
|
||||||
$this->creator = $creator;
|
$this->createdBy = $createdBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setLocation(Location $location)
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function delete()
|
|
||||||
{
|
{
|
||||||
|
$this->location = $location;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getLocation() : Location
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function create()
|
|
||||||
{
|
{
|
||||||
|
return $this->location;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getCalendar() : int
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function update()
|
|
||||||
{
|
{
|
||||||
|
return $this->calendar;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setCalendar(int $calendar)
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function serialize()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function unserialize($data)
|
|
||||||
{
|
{
|
||||||
|
$this->calendar = $calendar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
119
Models/EventMapper.php
Normal file
119
Models/EventMapper.php
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.0
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright 2013 Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
namespace Modules\Calendar\Models;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Builder;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Column;
|
||||||
|
|
||||||
|
class EventMapper extends DataMapperAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Columns.
|
||||||
|
*
|
||||||
|
* @var array<string, array>
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $columns = [
|
||||||
|
'calendar_event_id' => ['name' => 'calendar_event_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
|
'calendar_event_name' => ['name' => 'calendar_event_name', 'type' => 'string', 'internal' => 'name'],
|
||||||
|
'calendar_event_description' => ['name' => 'calendar_event_description', 'type' => 'string', 'internal' => 'description'],
|
||||||
|
'calendar_event_location' => ['name' => 'calendar_event_location', 'type' => 'Serializable', 'internal' => 'location'],
|
||||||
|
'calendar_event_status' => ['name' => 'calendar_event_status', 'type' => 'int', 'internal' => 'status'],
|
||||||
|
'calendar_event_calendar' => ['name' => 'calendar_event_calendar', 'type' => 'int', 'internal' => 'calendar'],
|
||||||
|
'calendar_event_created_by' => ['name' => 'task_created_by', 'type' => 'int', 'internal' => 'createdBy'],
|
||||||
|
'calendar_event_created_at' => ['name' => 'task_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $table = 'calendar_event';
|
||||||
|
|
||||||
|
protected static $createdAt = 'calendar_event_created_at';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary field name.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $primaryField = 'calendar_event_id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create media.
|
||||||
|
*
|
||||||
|
* @param Calendar $obj Media
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public function create($obj)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$objId = parent::create($obj);
|
||||||
|
$query = new Builder($this->db);
|
||||||
|
$query->prefix($this->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($obj->getCreatedBy(), 'task', 'task', 1, $objId, 1, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
$this->db->con->prepare($query->toSql())->execute();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find.
|
||||||
|
*
|
||||||
|
* @param array $columns Columns to select
|
||||||
|
*
|
||||||
|
* @return Builder
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public function find(...$columns) : Builder
|
||||||
|
{
|
||||||
|
return parent::find(...$columns)->from('account_permission')
|
||||||
|
->where('account_permission.account_permission_for', '=', 'task')
|
||||||
|
->where('account_permission.account_permission_id1', '=', 1)
|
||||||
|
->where('task.task_id', '=', new Column('account_permission.account_permission_id2'))
|
||||||
|
->where('account_permission.account_permission_r', '=', 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user