Numero de cuota
This commit is contained in:
@ -8,6 +8,7 @@ class Cuota extends Ideal\Model
|
||||
{
|
||||
public Model\Venta $venta;
|
||||
public Model\Venta\Pago $pago;
|
||||
public int $numero;
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
|
@ -14,11 +14,12 @@ class Cuota extends Ideal\Repository
|
||||
protected Repository\Venta\Pago $pagoRepository)
|
||||
{
|
||||
parent::__construct($connection);
|
||||
$this->setTable('venta_abono_cuotas');
|
||||
}
|
||||
|
||||
public function create(?array $data = null): Model\Venta\Abono\Cuota
|
||||
{
|
||||
$map = (new Implement\Repository\MapperParser())
|
||||
$map = (new Implement\Repository\MapperParser(['numero']))
|
||||
->register('venta_id', (new Implement\Repository\Mapper())
|
||||
->setProperty('venta')
|
||||
->setFunction(function($data) {
|
||||
@ -36,13 +37,13 @@ class Cuota extends Ideal\Repository
|
||||
|
||||
public function save(Define\Model $model): Model\Venta\Abono\Cuota
|
||||
{
|
||||
$model->id = $this->saveNew(['venta_id', 'pago_id'], [$model->venta->id, $model->pago->id]);
|
||||
$model->id = $this->saveNew(['venta_id', 'pago_id', 'numero'], [$model->venta->id, $model->pago->id, $model->numero]);
|
||||
return $model;
|
||||
}
|
||||
|
||||
public function edit(Define\Model $model, array $new_data): Model\Venta\Abono\Cuota
|
||||
{
|
||||
return $this->update($model, ['venta_id', 'pago_id'], $new_data);
|
||||
return $this->update($model, ['venta_id', 'pago_id', 'numero'], $new_data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user