19 lines
490 B
PHP
19 lines
490 B
PHP
<?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, bool $default = false)
|
|
{
|
|
$this->setFunction(function($data) use ($column) {
|
|
return $data[$column] !== 0;
|
|
});
|
|
$this->setDefault($default);
|
|
if ($property !== null) {
|
|
$this->setProperty($property);
|
|
}
|
|
}
|
|
}
|