Added Models
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user