More MVC style
This commit is contained in:
51
src/Repositories/PostRepositoryInterface.php
Normal file
51
src/Repositories/PostRepositoryInterface.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
/**
|
||||
* Interface décrivant les opérations sur les posts.
|
||||
*/
|
||||
interface PostRepositoryInterface
|
||||
{
|
||||
/**
|
||||
* Retourne tous les posts triés par id descendant.
|
||||
*
|
||||
* @return array<int, array{id:int, title:string, content:string}>
|
||||
*/
|
||||
public function allDesc(): array;
|
||||
|
||||
/**
|
||||
* Trouve un post par son id.
|
||||
*
|
||||
* @param int $id
|
||||
* @return array{id:int, title:string, content:string}|null
|
||||
*/
|
||||
public function find(int $id): ?array;
|
||||
|
||||
/**
|
||||
* Crée un post.
|
||||
*
|
||||
* @param array{title:string,content:string} $data
|
||||
* @return int id inséré
|
||||
*/
|
||||
public function create(array $data): int;
|
||||
|
||||
/**
|
||||
* Met à jour un post.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array{title:string,content:string} $data
|
||||
* @return void
|
||||
*/
|
||||
public function update(int $id, array $data): void;
|
||||
|
||||
/**
|
||||
* Supprime un post.
|
||||
*
|
||||
* @param int $id
|
||||
* @return void
|
||||
*/
|
||||
public function delete(int $id): void;
|
||||
}
|
||||
Reference in New Issue
Block a user