mirror of
https://github.com/Karaka-Management/oms-Tasks.git
synced 2026-01-11 15:38:40 +00:00
Fix #109
This commit is contained in:
parent
e693b8bba1
commit
731459ca58
|
|
@ -86,6 +86,14 @@ class Task implements \JsonSerializable
|
|||
|
||||
protected $isClosable = true;
|
||||
|
||||
/**
|
||||
* Start.
|
||||
*
|
||||
* @var \DateTime
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $start = null;
|
||||
|
||||
/**
|
||||
* Due.
|
||||
*
|
||||
|
|
@ -130,6 +138,7 @@ class Task implements \JsonSerializable
|
|||
public function __construct()
|
||||
{
|
||||
$this->createdAt = new \DateTime('now');
|
||||
$this->start = new \DateTime('now');
|
||||
$this->due = new \DateTime('now');
|
||||
$this->due->modify('+1 day');
|
||||
$this->schedule = new Schedule();
|
||||
|
|
@ -211,6 +220,26 @@ class Task implements \JsonSerializable
|
|||
$this->createdAt = $created;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getStart() : \DateTime
|
||||
{
|
||||
return $this->createdAt ?? new \DateTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime $created
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setStart(\DateTime $start)
|
||||
{
|
||||
$this->start = $start;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ class TaskMapper extends DataMapperAbstract
|
|||
'task_due' => ['name' => 'task_due', 'type' => 'DateTime', 'internal' => 'due'],
|
||||
'task_done' => ['name' => 'task_done', 'type' => 'DateTime', 'internal' => 'done'],
|
||||
'task_schedule' => ['name' => 'task_schedule', 'type' => 'int', 'internal' => 'schedule'],
|
||||
'task_start' => ['name' => 'task_start', 'type' => 'DateTime', 'internal' => 'start'],
|
||||
'task_created_by' => ['name' => 'task_created_by', 'type' => 'int', 'internal' => 'createdBy'],
|
||||
'task_created_at' => ['name' => 'task_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user