Version 3.0

New technologies
This commit is contained in:
2022-08-05 21:28:59 -04:00
parent 06071884c7
commit a9968dec58
69 changed files with 600 additions and 2696 deletions

View File

@ -0,0 +1,32 @@
<?php
namespace Contabilidad\Repository;
use Common\Alias\Repository;
use Common\Concept\Model;
use Contabilidad\Model\Cuenta as BaseModel;
class Cuenta extends Repository
{
public function __construct()
{
$this->setTable('cuentas');
$this->setProperties(['id', 'nombre', 'tipo']);
}
public function load(array $data_row): Model
{
return (new BaseModel())
->setId($data_row['id']);
}
public function fetchByKey($key): Model
{
$query = "SELECT * FROM {$this->getTable()} WHERE `id` = ?";
return $this->load($this->getDatabase()->prepare($query)->execute($key)[0]);
}
public function delete(Model $model): void
{
$query = "DELETE FROM {$this->getTable()} WHERE `id` = ?";
$this->getDatabase()->prepare($query)->delete([$model->getId()]);
}
}