Added Models

This commit is contained in:
julien
2026-03-09 12:22:50 +01:00
parent 18eabb0560
commit 4342751c70
7 changed files with 146 additions and 44 deletions

View File

@@ -4,6 +4,8 @@ declare(strict_types=1);
namespace App\Repositories;
use App\Models\Post;
/**
* Interface décrivant les opérations sur les posts.
*/
@@ -12,7 +14,7 @@ interface PostRepositoryInterface
/**
* Retourne tous les posts triés par id descendant.
*
* @return array<int, array{id:int, title:string, content:string}>
* @return Post[] Tableau d'objets Post
*/
public function allDesc(): array;
@@ -20,26 +22,26 @@ interface PostRepositoryInterface
* Trouve un post par son id.
*
* @param int $id
* @return array{id:int, title:string, content:string}|null
* @return Post|null
*/
public function find(int $id): ?array;
public function find(int $id): ?Post;
/**
* Crée un post.
*
* @param array{title:string,content:string} $data
* @param Post $post Instance contenant les données à insérer (id ignoré)
* @return int id inséré
*/
public function create(array $data): int;
public function create(Post $post): int;
/**
* Met à jour un post.
*
* @param int $id
* @param array{title:string,content:string} $data
* @param Post $post Données à mettre à jour (id ignoré)
* @return void
*/
public function update(int $id, array $data): void;
public function update(int $id, Post $post): void;
/**
* Supprime un post.