27 lines
789 B
PHP
27 lines
789 B
PHP
|
<?php
|
||
|
namespace Incoviba\Mapper;
|
||
|
|
||
|
use Incoviba\Model\Model;
|
||
|
use Incoviba\Model\Proyecto\ProyectoAgente as AgenteModel;
|
||
|
|
||
|
class ProyectoAgente extends Mapper
|
||
|
{
|
||
|
protected string $table = 'proyecto_agente';
|
||
|
|
||
|
protected function load(bool|array $row, bool $lazy = false): AgenteModel|bool
|
||
|
{
|
||
|
$model = new AgenteModel();
|
||
|
$model->id = $row['id'];
|
||
|
$model->proyecto = $this->getMapper(Proyecto::class)->fetchById($row['proyecto']);
|
||
|
$model->agenteTipo = $this->getMapper(AgenteTipo::class)->fetchById($row['agente']);
|
||
|
$model->fecha = new \DateTimeImmutable($row['fecha']);
|
||
|
$model->comision = $row['comision'];
|
||
|
return $model;
|
||
|
}
|
||
|
|
||
|
public function save(Model $model): bool
|
||
|
{
|
||
|
// TODO: Implement save() method.
|
||
|
}
|
||
|
}
|