Agregar Proveedor
This commit is contained in:
@ -1,28 +1,28 @@
|
||||
<?php
|
||||
namespace Incoviba\Service;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Common\Implement;
|
||||
use Incoviba\Model;
|
||||
use Incoviba\Repository;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Persona extends Ideal\Service
|
||||
{
|
||||
public function __construct(LoggerInterface $logger, protected Repository\Persona $personaRepository,
|
||||
protected Repository\DatosPersona $datosPersonaRepository)
|
||||
public function __construct(LoggerInterface $logger, protected Repository\Persona $personaRepository,
|
||||
protected Repository\Persona\Datos $datosPersonaRepository)
|
||||
{
|
||||
parent::__construct($logger);
|
||||
}
|
||||
|
||||
public function getByRut(int $rut): Model\Persona
|
||||
public function getById(int $rut): Model\Persona
|
||||
{
|
||||
return $this->process($this->personaRepository->fetchByRut($rut));
|
||||
return $this->process($this->personaRepository->fetchById($rut));
|
||||
}
|
||||
public function add(array $data): Model\Persona
|
||||
{
|
||||
try {
|
||||
$persona = $this->personaRepository->fetchByRut($data['rut']);
|
||||
$persona = $this->personaRepository->fetchById($data['rut']);
|
||||
} catch (Implement\Exception\EmptyResult) {
|
||||
$persona = $this->personaRepository->create($data);
|
||||
$persona = $this->personaRepository->save($persona);
|
||||
|
Reference in New Issue
Block a user