Implemented repository mapper, and venta show
This commit is contained in:
17
app/common/Implement/Repository/Mapper/Boolean.php
Normal file
17
app/common/Implement/Repository/Mapper/Boolean.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace Incoviba\Common\Implement\Repository\Mapper;
|
||||
|
||||
use Incoviba\Common\Implement\Repository\Mapper;
|
||||
|
||||
class Boolean extends Mapper
|
||||
{
|
||||
public function __construct(string $column, ?string $property = null)
|
||||
{
|
||||
$this->setFunction(function($data) use ($column) {
|
||||
return $data[$column] !== 0;
|
||||
});
|
||||
if ($property !== null) {
|
||||
$this->setProperty($property);
|
||||
}
|
||||
}
|
||||
}
|
18
app/common/Implement/Repository/Mapper/DateTime.php
Normal file
18
app/common/Implement/Repository/Mapper/DateTime.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?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) {
|
||||
return new DateTimeImmutable($data[$column]);
|
||||
});
|
||||
if ($property !== null) {
|
||||
$this->setProperty($property);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user