API 1.0.0-rc

This commit is contained in:
2021-07-27 22:29:56 -04:00
parent c2d7729e71
commit 6172da2f95
33 changed files with 1013 additions and 0 deletions

44
api/src/Fuente.php Normal file
View File

@ -0,0 +1,44 @@
<?php
namespace Contabilidad;
use ProVM\Common\Alias\Model;
/**
* @property int $id
* @property TipoFuente $tipo_id
* @property Banco $banco_id
*/
class Fuente extends Model {
public static $_table = 'fuentes';
protected static $fields = ['tipo_id', 'banco_id'];
protected $tipo;
public function tipo() {
if ($this->tipo === null) {
$this->tipo = $this->childOf(TipoFuente::class, [Model::SELF_KEY => 'tipo_id']);
}
return $this->tipo;
}
protected $banco;
public function banco() {
if ($this->banco === null) {
$this->banco = $this->childOf(Banco::class, [Model::SELF_KEY => 'banco_id']);
}
return $this->banco;
}
protected $entradas;
public function entradas() {
if ($this->entradas === null) {
$this->entradas = $this->parentOf(Entrada::class, [Model::CHILD_KEY => 'fuente_id']);
}
return $this->entradas;
}
public function toArray(): array {
$arr = parent::toArray();
$arr['tipo'] = $this->tipo()->toArray();
$arr['banco'] = $this->banco()->toArray();
return $arr;
}
}