Files
oficial/app/common/Implement/Repository/Mapper/DateTime.php

19 lines
477 B
PHP
Raw Normal View History

<?php
namespace Incoviba\Common\Implement\Repository\Mapper;
use DateTimeImmutable;
use Incoviba\Common\Implement\Repository\Mapper;
class DateTime extends Mapper
{
public function __construct(string $column, ?string $property = null)
{
$this->setFunction(function($data) use ($column) {
2023-12-22 14:14:02 -03:00
return new DateTimeImmutable($data[$column] ?? '');
});
if ($property !== null) {
$this->setProperty($property);
}
}
}