54 lines
1.0 KiB
PHP
54 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Repositories;
|
|
|
|
use App\Models\Post;
|
|
|
|
/**
|
|
* Interface décrivant les opérations sur les posts.
|
|
*/
|
|
interface PostRepositoryInterface
|
|
{
|
|
/**
|
|
* Retourne tous les posts triés par id descendant.
|
|
*
|
|
* @return Post[] Tableau d'objets Post
|
|
*/
|
|
public function allDesc(): array;
|
|
|
|
/**
|
|
* Trouve un post par son id.
|
|
*
|
|
* @param int $id
|
|
* @return Post|null
|
|
*/
|
|
public function find(int $id): ?Post;
|
|
|
|
/**
|
|
* Crée un post.
|
|
*
|
|
* @param Post $post Instance contenant les données à insérer (id ignoré)
|
|
* @return int id inséré
|
|
*/
|
|
public function create(Post $post): int;
|
|
|
|
/**
|
|
* Met à jour un post.
|
|
*
|
|
* @param int $id
|
|
* @param Post $post Données à mettre à jour (id ignoré)
|
|
* @return void
|
|
*/
|
|
public function update(int $id, Post $post): void;
|
|
|
|
/**
|
|
* Supprime un post.
|
|
*
|
|
* @param int $id
|
|
* @return void
|
|
*/
|
|
public function delete(int $id): void;
|
|
}
|