mirror of
https://github.com/Karaka-Management/oms-Kanban.git
synced 2026-02-11 17:58:41 +00:00
implement immutable datetime
This commit is contained in:
parent
ee40af6480
commit
5912df63b9
|
|
@ -57,7 +57,7 @@ class KanbanBoard implements \JsonSerializable
|
|||
|
||||
private Account $createdBy;
|
||||
|
||||
private \DateTime $createdAt;
|
||||
private \DateTimeImmutable $createdAt;
|
||||
|
||||
private array $columns = [];
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ class KanbanBoard implements \JsonSerializable
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->createdAt = new \DateTime('now');
|
||||
$this->createdAt = new \DateTimeImmutable('now');
|
||||
$this->createdBy = new NullAccount();
|
||||
}
|
||||
|
||||
|
|
@ -221,7 +221,7 @@ class KanbanBoard implements \JsonSerializable
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCreatedAt() : \DateTime
|
||||
public function getCreatedAt() : \DateTimeInterface
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ final class KanbanBoardMapper extends DataMapperAbstract
|
|||
'kanban_board_status' => ['name' => 'kanban_board_status', 'type' => 'int', 'internal' => 'status'],
|
||||
'kanban_board_order' => ['name' => 'kanban_board_order', 'type' => 'int', 'internal' => 'order'],
|
||||
'kanban_board_created_by' => ['name' => 'kanban_board_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
||||
'kanban_board_created_at' => ['name' => 'kanban_board_created_at', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true],
|
||||
'kanban_board_created_at' => ['name' => 'kanban_board_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class KanbanCard implements \JsonSerializable
|
|||
|
||||
private Account $createdBy;
|
||||
|
||||
private \DateTime $createdAt;
|
||||
private \DateTimeImmutable $createdAt;
|
||||
|
||||
private array $comments = [];
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ class KanbanCard implements \JsonSerializable
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->createdAt = new \DateTime('now');
|
||||
$this->createdAt = new \DateTimeImmutable('now');
|
||||
$this->createdBy = new NullAccount();
|
||||
}
|
||||
|
||||
|
|
@ -310,7 +310,7 @@ class KanbanCard implements \JsonSerializable
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCreatedAt() : \DateTime
|
||||
public function getCreatedAt() : \DateTimeInterface
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class KanbanCardComment implements \JsonSerializable
|
|||
|
||||
private Account $createdBy;
|
||||
|
||||
private \DateTime $createdAt;
|
||||
private \DateTimeImmutable $createdAt;
|
||||
|
||||
private array $media = [];
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ class KanbanCardComment implements \JsonSerializable
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->createdAt = new \DateTime('now');
|
||||
$this->createdAt = new \DateTimeImmutable('now');
|
||||
$this->createdBy = new NullAccount();
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ class KanbanCardComment implements \JsonSerializable
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCreatedAt() : \DateTime
|
||||
public function getCreatedAt() : \DateTimeInterface
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ final class KanbanCardCommentMapper extends DataMapperAbstract
|
|||
'kanban_card_comment_id' => ['name' => 'kanban_card_comment_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'kanban_card_comment_description' => ['name' => 'kanban_card_comment_description', 'type' => 'string', 'internal' => 'description'],
|
||||
'kanban_card_comment_card' => ['name' => 'kanban_card_comment_card', 'type' => 'int', 'internal' => 'card'],
|
||||
'kanban_card_comment_created_at' => ['name' => 'kanban_card_comment_created_at', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true],
|
||||
'kanban_card_comment_created_at' => ['name' => 'kanban_card_comment_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||
'kanban_card_comment_created_by' => ['name' => 'kanban_card_comment_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ final class KanbanCardMapper extends DataMapperAbstract
|
|||
'kanban_card_order' => ['name' => 'kanban_card_order', 'type' => 'int', 'internal' => 'order'],
|
||||
'kanban_card_ref' => ['name' => 'kanban_card_ref', 'type' => 'int', 'internal' => 'ref'],
|
||||
'kanban_card_column' => ['name' => 'kanban_card_column', 'type' => 'int', 'internal' => 'column'],
|
||||
'kanban_card_created_at' => ['name' => 'kanban_card_created_at', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true],
|
||||
'kanban_card_created_at' => ['name' => 'kanban_card_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||
'kanban_card_created_by' => ['name' => 'kanban_card_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class KanbanBoardTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals('', $board->getName());
|
||||
self::assertEquals('', $board->getDescription());
|
||||
self::assertEquals(0, $board->getCreatedBy()->getId());
|
||||
self::assertInstanceOf('\DateTime', $board->getCreatedAt());
|
||||
self::assertInstanceOf('\DateTimeImmutable', $board->getCreatedAt());
|
||||
self::assertEquals([], $board->getColumns());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class KanbanCardCommentTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(0, $comment->getCard());
|
||||
self::assertEquals('', $comment->getDescription());
|
||||
self::assertEquals(0, $comment->getCreatedBy()->getId());
|
||||
self::assertInstanceOf('\DateTime', $comment->getCreatedAt());
|
||||
self::assertInstanceOf('\DateTimeImmutable', $comment->getCreatedAt());
|
||||
self::assertEquals([], $comment->getMedia());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class KanbanCardTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(0, $card->getColumn());
|
||||
self::assertEquals(0, $card->getOrder());
|
||||
self::assertEquals(0, $card->getCreatedBy()->getId());
|
||||
self::assertInstanceOf('\DateTime', $card->getCreatedAt());
|
||||
self::assertInstanceOf('\DateTimeImmutable', $card->getCreatedAt());
|
||||
self::assertEquals([], $card->getComments());
|
||||
self::assertEquals([], $card->getLabels());
|
||||
self::assertEquals([], $card->getMedia());
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user