Changed model to be jsonserialiazable and it's factory into repository

Added model, create and required/optional to repository
This commit is contained in:
2022-09-09 15:55:45 -04:00
parent 3811e8224b
commit 806b8e7b93
4 changed files with 122 additions and 13 deletions

View File

@ -1,12 +1,13 @@
<?php
namespace ProVM\Concept;
use ProVM\Concept\Model\Factory;
use JsonSerializable;
use ProVM\Concept\Model\Repository;
interface Model
interface Model extends JsonSerializable
{
public function setFactory(Factory $factory): Model;
public function getFactory(): Factory;
public function setRepository(Repository $factory): Model;
public function getRepository(): Repository;
public function setId(int $id): Model;
public function getId(): int;
public function setNew(): Model;

View File

@ -13,16 +13,26 @@ interface Repository
public function getQueryBuilder(): QueryBuilder;
public function setFactory(Factory $factory): Repository;
public function getFactory(): Factory;
public function setModel(string $model_class): Repository;
public function getModel(): string;
public function getNewModel(): Model;
public function setup(): Repository;
public function setTable(string $table): Repository;
public function getTable(): string;
public function setColumns(array $columns): Repository;
public function addColumn(string $column): Repository;
public function getColumns(): array;
public function setRequired(array $columns): Repository;
public function addRequired(string $column): Repository;
public function getRequired(): array;
public function setOptional(array $columns): Repository;
public function addOptional(string $column): Repository;
public function getOptional(): array;
public function fillData(Model $model, array $data): Model;
public function load(array $data): Model;
public function save(Model $model): void;
public function edit(Model $model, array $data): Model;
public function create(array $data): Model;
public function edit(Model $model, array $data): Model;
public function delete(Model $model): void;
public function fetchById(int $id): Model;
public function fetchAll(): array;