mirror of
https://github.com/Karaka-Management/oms-Editor.git
synced 2026-01-23 14:58:42 +00:00
implement immutable datetime
This commit is contained in:
parent
d77c9477c4
commit
618e53d44f
|
|
@ -75,7 +75,7 @@ class EditorDoc implements \JsonSerializable, ArrayableInterface
|
|||
* @var \DateTime
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private \DateTime $createdAt;
|
||||
private \DateTimeImmutable $createdAt;
|
||||
|
||||
/**
|
||||
* Creator.
|
||||
|
|
@ -101,7 +101,7 @@ class EditorDoc implements \JsonSerializable, ArrayableInterface
|
|||
public function __construct()
|
||||
{
|
||||
$this->createdBy = new NullAccount();
|
||||
$this->createdAt = new \DateTime('now');
|
||||
$this->createdAt = new \DateTimeImmutable('now');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -163,7 +163,7 @@ class EditorDoc implements \JsonSerializable, ArrayableInterface
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCreatedAt() : \DateTime
|
||||
public function getCreatedAt() : \DateTimeInterface
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ final class EditorDocMapper extends DataMapperAbstract
|
|||
'editor_doc_plain' => ['name' => 'editor_doc_plain', 'type' => 'string', 'internal' => 'plain'],
|
||||
'editor_doc_content' => ['name' => 'editor_doc_content', 'type' => 'string', 'internal' => 'content'],
|
||||
'editor_doc_path' => ['name' => 'editor_doc_path', 'type' => 'string', 'internal' => 'path'],
|
||||
'editor_doc_created_at' => ['name' => 'editor_doc_created_at', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true],
|
||||
'editor_doc_created_at' => ['name' => 'editor_doc_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user