Separacion de Promocion de Contrato y Precio

"Simplificacion" de datos en listado de precios
This commit is contained in:
Juan Pablo Vial
2025-03-17 22:49:48 -03:00
parent 2e49e2c947
commit bae0f1f555
13 changed files with 479 additions and 278 deletions

View File

@ -13,7 +13,8 @@ class Promotion extends Ideal\Service
{
public function __construct(LoggerInterface $logger,
protected Repository\Venta\Promotion $promotionRepository,
protected Repository\Proyecto\Broker\Contract $contractRepository)
protected Repository\Proyecto\Broker\Contract $contractRepository,
protected Repository\Venta\Unidad $unidadRepository)
{
parent::__construct($logger);
}
@ -80,6 +81,12 @@ class Promotion extends Ideal\Service
protected function process(Model\Venta\Promotion $model): Model\Venta\Promotion
{
$model->addFactory('contracts', (new Implement\Repository\Factory())
->setCallable([$this->contractRepository, 'fetchByPromotion'])
->setArgs(['promotion_id' => $model->id]));
$model->addFactory('units', (new Implement\Repository\Factory())
->setCallable([$this->unidadRepository, 'fetchByPromotion'])
->setArgs(['promotion_id' => $model->id]));
return $model;
}
}