Auth, Login, Home, Venta->Listados->Precios

This commit is contained in:
Juan Pablo Vial
2023-07-24 20:55:26 -04:00
parent d9d5a15376
commit 1a7b10ce3c
130 changed files with 4302 additions and 0 deletions

View File

@ -0,0 +1,55 @@
<?php
namespace Incoviba\Repository;
use Incoviba\Common\Ideal;
use Incoviba\Common\Define;
use Incoviba\Model;
use Incoviba\Repository;
class Inmobiliaria extends Ideal\Repository
{
public function __construct(Define\Connection $connection, protected Repository\Banco $bancoRepository, protected Repository\Inmobiliaria\TipoSociedad $tipoSociedadRepository)
{
parent::__construct($connection);
$this->setTable('inmobiliaria');
}
protected function getKey(): string
{
return 'rut';
}
public function create(?array $data = null): Define\Model
{
$map = [
'dv' => [],
'razon' => [],
'abreviacion' => [],
'cuenta' => [],
'banco' => [
'function' => function($data) {
return $this->bancoRepository->fetchById($data['banco']);
}
],
'sociedad' => [
'property' => 'tipoSociedad',
'function' => function($data) {
return $this->tipoSociedadRepository->fetchById($data['sociedad']);
}
]
];
return $this->parseData(new Model\Inmobiliaria(), $data, $map);
}
public function save(Define\Model $model): Define\Model
{
$model->rut = $this->saveNew(
['dv', 'razon', 'abreviacion', 'cuenta', 'banco', 'sociedad'],
[$model->dv, $model->razon, $model->abreviacion, $model->cuenta, $model->banco->id, $model->tipoSociedad->id]
);
return $model;
}
public function edit(Define\Model $model, array $new_data): Define\Model
{
return $this->update($model, ['dv', 'razon', 'abreviacion', 'cuenta', 'banco', 'sociedad'], $new_data);
}
}