implement immutable datetime

This commit is contained in:
Dennis Eichhorn 2020-09-10 20:18:47 +02:00
parent 1e2d638a99
commit 724da76892
2 changed files with 3 additions and 3 deletions

View File

@ -64,7 +64,7 @@ class Supplier
*/
public function __construct()
{
$this->createdAt = new \DateTime('now');
$this->createdAt = new \DateTimeImmutable('now');
$this->profile = new Profile();
}
@ -247,7 +247,7 @@ class Supplier
*
* @since 1.0.0
*/
public function getCreatedAt() : \DateTime
public function getCreatedAt() : \DateTimeInterface
{
return $this->createdAt;
}

View File

@ -44,7 +44,7 @@ final class SupplierMapper extends DataMapperAbstract
'suppliermgmt_supplier_type' => ['name' => 'suppliermgmt_supplier_type', 'type' => 'int', 'internal' => 'type'],
'suppliermgmt_supplier_taxid' => ['name' => 'suppliermgmt_supplier_taxid', 'type' => 'int', 'internal' => 'taxId'],
'suppliermgmt_supplier_info' => ['name' => 'suppliermgmt_supplier_info', 'type' => 'string', 'internal' => 'info'],
'suppliermgmt_supplier_created_at' => ['name' => 'suppliermgmt_supplier_created_at', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true],
'suppliermgmt_supplier_created_at' => ['name' => 'suppliermgmt_supplier_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
'suppliermgmt_supplier_account' => ['name' => 'suppliermgmt_supplier_account', 'type' => 'int', 'internal' => 'profile'],
];