Interfaces
This commit is contained in:
18
src/Concept/Model.php
Normal file
18
src/Concept/Model.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
namespace ProVM\Concept;
|
||||
|
||||
use ProVM\Concept\Model\Factory;
|
||||
|
||||
interface Model
|
||||
{
|
||||
public function setFactory(Factory $factory): Model;
|
||||
public function getFactory(): Factory;
|
||||
public function setId(int $id): Model;
|
||||
public function getId(): int;
|
||||
public function setNew(): Model;
|
||||
public function isNew(): bool;
|
||||
public function setDirty(): Model;
|
||||
public function isDirty(): bool;
|
||||
public function save(): void;
|
||||
public function edit(array $data): void;
|
||||
}
|
13
src/Concept/Model/Factory.php
Normal file
13
src/Concept/Model/Factory.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace ProVM\Concept\Model;
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
interface Factory
|
||||
{
|
||||
public function setContainer(ContainerInterface $container): Factory;
|
||||
public function getContainer(): ContainerInterface;
|
||||
public function setNamespace(string $namespace): Factory;
|
||||
public function getNamespace(): string;
|
||||
public function get(string $repository_name): Repository;
|
||||
}
|
28
src/Concept/Model/Repository.php
Normal file
28
src/Concept/Model/Repository.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
namespace ProVM\Concept\Model;
|
||||
|
||||
use ProVM\Concept\Database\Connection;
|
||||
use ProVM\Concept\Database\QueryBuilder;
|
||||
use ProVM\Concept\Model;
|
||||
|
||||
interface Repository
|
||||
{
|
||||
public function setConnection(Connection $connection): Repository;
|
||||
public function getConnection(): Connection;
|
||||
public function setQueryBuilder(QueryBuilder $builder): Repository;
|
||||
public function getQueryBuilder(): QueryBuilder;
|
||||
public function setFactory(Factory $factory): Repository;
|
||||
public function getFactory(): Factory;
|
||||
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 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 fetchById(int $id): Model;
|
||||
public function fetchAll(): array;
|
||||
}
|
Reference in New Issue
Block a user