first commit

This commit is contained in:
julien
2026-03-20 22:16:20 +01:00
commit 42a4ba3e9a
136 changed files with 10141 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace App\Post\Infrastructure;
use Netig\Netslim\Taxonomy\Contracts\TaxonUsageCheckerInterface;
use PDO;
/**
* Vérifie si un terme de taxonomie est encore référencé par au moins un post.
*/
final readonly class PdoTaxonUsageChecker implements TaxonUsageCheckerInterface
{
public function __construct(private PDO $db) {}
public function isTaxonInUse(int $taxonId): bool
{
$stmt = $this->db->prepare('SELECT COUNT(*) FROM posts WHERE category_id = :category_id');
$stmt->execute([':category_id' => $taxonId]);
return (int) $stmt->fetchColumn() > 0;
}
}