75 lines
2.1 KiB
PHP
75 lines
2.1 KiB
PHP
<?php
|
|
|
|
require_once "Comment.php";
|
|
|
|
/**
|
|
* Schnittstelle für die Verwaltung von Kommentaren.
|
|
*
|
|
* Definiert die grundlegenden Methoden zum
|
|
* Speichern und Laden von Kommentaren.
|
|
*
|
|
* @author Caroline Schulte
|
|
*/
|
|
interface CommentManagerDAO
|
|
{
|
|
/**
|
|
* Speichert einen neuen Kommentar zu einem Beitrag.
|
|
*
|
|
* Optional kann eine parentCommentId übergeben werden,
|
|
* wenn der Kommentar eine Antwort auf einen anderen Kommentar ist.
|
|
*
|
|
* @param int $articleId ID des Beitrags
|
|
* @param string $author Autor des Kommentars
|
|
* @param string $content Inhalt des Kommentars
|
|
* @param int|null $parentCommentId ID des Eltern-Kommentars oder null
|
|
*
|
|
* @return int ID des neu gespeicherten Kommentars
|
|
*/
|
|
public function addComment(
|
|
$articleId,
|
|
$author,
|
|
$content,
|
|
$parentCommentId = null
|
|
);
|
|
|
|
/**
|
|
* Gibt alle Kommentare eines Beitrags zurück.
|
|
*
|
|
* @param int $articleId ID des Beitrags
|
|
*
|
|
* @return Comment[] Liste der Kommentare
|
|
*/
|
|
public function getCommentsByArticle(
|
|
$articleId
|
|
);
|
|
|
|
/**
|
|
* Gibt alle Kommentare eines Autors zurück.
|
|
*
|
|
* @param string $author E-Mail-Adresse des Autors
|
|
*
|
|
* @return Comment[] Liste der Kommentare
|
|
*/
|
|
public function getCommentsByAuthor($author);
|
|
/**
|
|
* Löscht einen einzelnen Kommentar des angemeldeten Nutzers.
|
|
*
|
|
* Kommentare ohne Antworten werden vollständig entfernt.
|
|
* Kommentare mit Antworten bleiben als anonymer Platzhalter erhalten.
|
|
*
|
|
* @param int $commentId ID des Kommentars
|
|
* @param string $author E-Mail-Adresse des Autors
|
|
* @return bool true, wenn der Kommentar gefunden und gelöscht wurde
|
|
*/
|
|
public function deleteComment(int $commentId, string $author): bool;
|
|
|
|
/**
|
|
* Löscht beziehungsweise anonymisiert alle Kommentare eines Nutzers.
|
|
*
|
|
* Diese Methode wird bei der Löschung eines Benutzerkontos verwendet.
|
|
*
|
|
* @param string $author E-Mail-Adresse des Nutzers
|
|
* @return void
|
|
*/
|
|
public function deleteCommentsByAuthor(string $author): void;
|
|
} |