This commit is contained in:
Dennis Eichhorn 2017-10-05 19:19:45 +02:00
parent e693b8bba1
commit 731459ca58
2 changed files with 30 additions and 0 deletions

View File

@ -86,6 +86,14 @@ class Task implements \JsonSerializable
protected $isClosable = true; protected $isClosable = true;
/**
* Start.
*
* @var \DateTime
* @since 1.0.0
*/
protected $start = null;
/** /**
* Due. * Due.
* *
@ -130,6 +138,7 @@ class Task implements \JsonSerializable
public function __construct() public function __construct()
{ {
$this->createdAt = new \DateTime('now'); $this->createdAt = new \DateTime('now');
$this->start = new \DateTime('now');
$this->due = new \DateTime('now'); $this->due = new \DateTime('now');
$this->due->modify('+1 day'); $this->due->modify('+1 day');
$this->schedule = new Schedule(); $this->schedule = new Schedule();
@ -211,6 +220,26 @@ class Task implements \JsonSerializable
$this->createdAt = $created; $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 * @return mixed
* *

View File

@ -52,6 +52,7 @@ class TaskMapper extends DataMapperAbstract
'task_due' => ['name' => 'task_due', 'type' => 'DateTime', 'internal' => 'due'], 'task_due' => ['name' => 'task_due', 'type' => 'DateTime', 'internal' => 'due'],
'task_done' => ['name' => 'task_done', 'type' => 'DateTime', 'internal' => 'done'], 'task_done' => ['name' => 'task_done', 'type' => 'DateTime', 'internal' => 'done'],
'task_schedule' => ['name' => 'task_schedule', 'type' => 'int', 'internal' => 'schedule'], '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_by' => ['name' => 'task_created_by', 'type' => 'int', 'internal' => 'createdBy'],
'task_created_at' => ['name' => 'task_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'], 'task_created_at' => ['name' => 'task_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
]; ];