32 lines
968 B
PHP
32 lines
968 B
PHP
|
<?php
|
||
|
namespace Incoviba\Repository\Proyecto;
|
||
|
|
||
|
use Incoviba\Common\Ideal;
|
||
|
use Incoviba\Common\Define;
|
||
|
use Incoviba\Common\Implement;
|
||
|
use Incoviba\Model;
|
||
|
|
||
|
class Etapa extends Ideal\Repository
|
||
|
{
|
||
|
public function __construct(Define\Connection $connection)
|
||
|
{
|
||
|
parent::__construct($connection);
|
||
|
$this->setTable('etapa_proyecto');
|
||
|
}
|
||
|
|
||
|
public function create(?array $data = null): Model\Proyecto\Etapa
|
||
|
{
|
||
|
$map = new Implement\Repository\MapperParser(['descripcion', 'orden']);
|
||
|
return $this->parseData(new Model\Proyecto\Etapa(), $data, $map);
|
||
|
}
|
||
|
public function save(Define\Model $model): Model\Proyecto\Etapa
|
||
|
{
|
||
|
$model->id = $this->saveNew(['descripcion', 'orden'], [$model->descripcion, $model->orden]);
|
||
|
return $model;
|
||
|
}
|
||
|
public function edit(Define\Model $model, array $new_data): Model\Proyecto\Etapa
|
||
|
{
|
||
|
return $this->update($model, ['descripcion', 'orden'], $new_data);
|
||
|
}
|
||
|
}
|