This repository has been archived on 2026-03-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blog-slim.old/src/Repositories/PostRepositoryInterface.php
2026-03-09 12:22:50 +01:00

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;
}