Servicio y vista

This commit is contained in:
Juan Pablo Vial
2024-11-29 17:47:12 -03:00
parent 1f0f25bbde
commit b2c55c08ce
3 changed files with 61 additions and 38 deletions

View File

@ -0,0 +1,35 @@
<?php
namespace Incoviba\Service\Inmobiliaria;
use Psr\Log\LoggerInterface;
use Incoviba\Common\Ideal;
use Incoviba\Common\Implement;
use Incoviba\Common\Define;
use Incoviba\Repository;
use Incoviba\Model;
class Proveedor extends Ideal\Service
{
public function __construct(LoggerInterface $logger, protected Repository\Inmobiliaria\Proveedor $proveedorRepository)
{
parent::__construct($logger);
}
public function getAll(?string $orderBy = null): array
{
try {
return $this->proveedorRepository->fetchAll($orderBy);
} catch (Implement\Exception\EmptyResult) {
return [];
}
}
public function getByRut(int $proveedor_rut): ?Model\Inmobiliaria\Proveedor
{
try {
return $this->proveedorRepository->fetchById($proveedor_rut);
} catch (Implement\Exception\EmptyResult) {
return null;
}
}
}