mirror of
https://github.com/Karaka-Management/oms-Tasks.git
synced 2026-02-16 14:48:41 +00:00
implement immutable datetime
This commit is contained in:
parent
279d6cc6f9
commit
58858e2f7d
|
|
@ -62,7 +62,7 @@ class Task implements \JsonSerializable
|
||||||
* @var \DateTime
|
* @var \DateTime
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected \DateTime $createdAt;
|
protected \DateTimeImmutable $createdAt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description.
|
* Description.
|
||||||
|
|
@ -184,7 +184,7 @@ class Task implements \JsonSerializable
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->createdBy = new NullAccount();
|
$this->createdBy = new NullAccount();
|
||||||
$this->createdAt = new \DateTime('now');
|
$this->createdAt = new \DateTimeImmutable('now');
|
||||||
$this->schedule = new Schedule();
|
$this->schedule = new Schedule();
|
||||||
$this->start = new \DateTime('now');
|
$this->start = new \DateTime('now');
|
||||||
$this->due = new \DateTime('now');
|
$this->due = new \DateTime('now');
|
||||||
|
|
@ -410,7 +410,7 @@ class Task implements \JsonSerializable
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function getCreatedAt() : \DateTime
|
public function getCreatedAt() : \DateTimeInterface
|
||||||
{
|
{
|
||||||
return $this->createdAt;
|
return $this->createdAt;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ class TaskElement implements \JsonSerializable
|
||||||
* @var \DateTime
|
* @var \DateTime
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private \DateTime $createdAt;
|
private \DateTimeImmutable $createdAt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Status.
|
* Status.
|
||||||
|
|
@ -135,7 +135,7 @@ class TaskElement implements \JsonSerializable
|
||||||
{
|
{
|
||||||
$this->due = new \DateTime('now');
|
$this->due = new \DateTime('now');
|
||||||
$this->due->modify('+1 day');
|
$this->due->modify('+1 day');
|
||||||
$this->createdAt = new \DateTime('now');
|
$this->createdAt = new \DateTimeImmutable('now');
|
||||||
$this->createdBy = new NullAccount();
|
$this->createdBy = new NullAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,7 +156,7 @@ class TaskElement implements \JsonSerializable
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function getCreatedAt() : \DateTime
|
public function getCreatedAt() : \DateTimeInterface
|
||||||
{
|
{
|
||||||
return $this->createdAt;
|
return $this->createdAt;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ final class TaskElementMapper extends DataMapperAbstract
|
||||||
'task_element_due' => ['name' => 'task_element_due', 'type' => 'DateTime', 'internal' => 'due'],
|
'task_element_due' => ['name' => 'task_element_due', 'type' => 'DateTime', 'internal' => 'due'],
|
||||||
'task_element_task' => ['name' => 'task_element_task', 'type' => 'int', 'internal' => 'task'],
|
'task_element_task' => ['name' => 'task_element_task', 'type' => 'int', 'internal' => 'task'],
|
||||||
'task_element_created_by' => ['name' => 'task_element_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
'task_element_created_by' => ['name' => 'task_element_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
||||||
'task_element_created_at' => ['name' => 'task_element_created_at', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true],
|
'task_element_created_at' => ['name' => 'task_element_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ final class TaskMapper extends DataMapperAbstract
|
||||||
'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_start' => ['name' => 'task_start', 'type' => 'DateTime', 'internal' => 'start'],
|
||||||
'task_created_by' => ['name' => 'task_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
'task_created_by' => ['name' => 'task_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
||||||
'task_created_at' => ['name' => 'task_created_at', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true],
|
'task_created_at' => ['name' => 'task_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user