ContentSourceRepository.php
- Pfad:
src/Infrastructure/Persistence/ContentSourceRepository.php - Namespace: Infrastructure\Persistence
- Zeilen: 35 | Größe: 862 Bytes
- Geändert: 2025-12-25 16:57:28 | Gescannt: 2025-12-31 10:22:15
Code Hygiene Score: 100
- Dependencies: 100 (25%)
- LOC: 100 (20%)
- Methods: 100 (20%)
- Secrets: 100 (15%)
- Classes: 100 (10%)
- Magic Numbers: 100 (10%)
Keine Issues gefunden.
Dependencies 3
- implements Domain\Repository\ContentSourceRepositoryInterface
- constructor PDO
- use Domain\Repository\ContentSourceRepositoryInterface
Klassen 1
-
ContentSourceRepositoryclass Zeile 11
Funktionen 2
-
__construct()public Zeile 15 -
findSourcesByOrder()public Zeile 20
Verwendet von 1
Code
<?php
declare(strict_types=1);
namespace Infrastructure\Persistence;
// @responsibility: Persistenz für Content-Sources
use Domain\Repository\ContentSourceRepositoryInterface;
class ContentSourceRepository implements ContentSourceRepositoryInterface
{
private \PDO $pdo;
public function __construct(\PDO $pdo)
{
$this->pdo = $pdo;
}
public function findSourcesByOrder(int $orderId): array
{
$stmt = $this->pdo->prepare('
SELECT cs.*, c.content, d.filename as document_name
FROM content_sources cs
JOIN chunks c ON cs.chunk_id = c.id
JOIN documents d ON c.document_id = d.id
WHERE cs.order_id = :order_id
ORDER BY cs.relevance_score DESC
');
$stmt->execute(['order_id' => $orderId]);
return $stmt->fetchAll();
}
}