api-erstellen #1

Merged
TorstenHettstedt merged 52 commits from api-erstellen into master 2021-04-07 13:00:46 +02:00
5 changed files with 91 additions and 0 deletions
Showing only changes of commit 5141fff827 - Show all commits
@@ -0,0 +1,12 @@
<?php
namespace TorstenHettstedt\TimekeepingApi\Repositories;
use Exception;
class RepositoryException extends Exception
{
}
@@ -0,0 +1,28 @@
<?php
namespace TorstenHettstedt\TimekeepingApi\Repositories;
/**
* @template T of \TorstenHettstedt\TimekeepingApi\Models\ModelInterface
*/
interface RepositoryReaderInterface
{
/**
*
* Gibt alle vorhandenen Einträge zurück
*
* @return T[]
*/
public function findAll(): array;
/**
* Gibt den Eintrag zurück, der durch die ID
*
* @param mixed $primary_key
*
* @return T
* @throws RepositoryRecordNotFoundException
*/
public function findByKey(mixed $primary_key);
}
@@ -0,0 +1,10 @@
<?php
namespace TorstenHettstedt\TimekeepingApi\Repositories;
class RepositoryRecordNotFoundException extends RepositoryException
{
}
@@ -0,0 +1,31 @@
<?php
namespace TorstenHettstedt\TimekeepingApi\Repositories;
/**
* @template T of \TorstenHettstedt\TimekeepingApi\Models\ModelInterface
*/
interface RepositoryWriterInterface
{
/**
* @param T $model
*
* @throws UnsupportedModelException
*/
public function insert(mixed $model): void;
/**
* @param T $model
*
* @throws UnsupportedModelException
*/
public function update(mixed $model): void;
/**
* @param T $model
*
* @throws UnsupportedModelException
*/
public function delete(mixed $model): void;
}
@@ -0,0 +1,10 @@
<?php
namespace TorstenHettstedt\TimekeepingApi\Repositories;
class UnsupportedModelException extends RepositoryException
{
}