mirror of
https://github.com/Karaka-Management/oms-Marketing.git
synced 2026-02-17 18:38:41 +00:00
implement immutable datetime
This commit is contained in:
parent
71d165b1e5
commit
0c7cd4b132
|
|
@ -78,7 +78,7 @@ class Promotion
|
||||||
* @var \DateTime
|
* @var \DateTime
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private \DateTime $createdAt;
|
private \DateTimeImmutable $createdAt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by.
|
* Created by.
|
||||||
|
|
@ -102,7 +102,7 @@ class Promotion
|
||||||
$this->start = new \DateTime('now');
|
$this->start = new \DateTime('now');
|
||||||
$this->end = new \DateTime('now');
|
$this->end = new \DateTime('now');
|
||||||
$this->end->modify('+1 month');
|
$this->end->modify('+1 month');
|
||||||
$this->createdAt = new \DateTime('now');
|
$this->createdAt = new \DateTimeImmutable('now');
|
||||||
$this->createdBy = new NullAccount();
|
$this->createdBy = new NullAccount();
|
||||||
|
|
||||||
$this->calendar = new Calendar();
|
$this->calendar = new Calendar();
|
||||||
|
|
@ -482,7 +482,7 @@ class Promotion
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function getCreatedAt() : \DateTime
|
public function getCreatedAt() : \DateTimeInterface
|
||||||
{
|
{
|
||||||
return $this->createdAt;
|
return $this->createdAt;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ final class PromotionMapper extends DataMapperAbstract
|
||||||
'marketing_promotion_progress' => ['name' => 'marketing_promotion_progress', 'type' => 'int', 'internal' => 'progress'],
|
'marketing_promotion_progress' => ['name' => 'marketing_promotion_progress', 'type' => 'int', 'internal' => 'progress'],
|
||||||
'marketing_promotion_progress_type' => ['name' => 'marketing_promotion_progress_type', 'type' => 'int', 'internal' => 'progressType'],
|
'marketing_promotion_progress_type' => ['name' => 'marketing_promotion_progress_type', 'type' => 'int', 'internal' => 'progressType'],
|
||||||
'marketing_promotion_created_by' => ['name' => 'marketing_promotion_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
'marketing_promotion_created_by' => ['name' => 'marketing_promotion_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
||||||
'marketing_promotion_created_at' => ['name' => 'marketing_promotion_created_at', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true],
|
'marketing_promotion_created_at' => ['name' => 'marketing_promotion_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user