| 1 |
<?php |
| 2 |
|
| 3 |
namespace AATXT\App\Infrastructure\Repositories; |
| 4 |
|
| 5 |
use AATXT\App\Domain\Entities\ErrorLog; |
| 6 |
|
| 7 |
/** |
| 8 |
* ErrorLog Repository Interface |
| 9 |
* |
| 10 |
* Defines the contract for persisting and retrieving ErrorLog entities. |
| 11 |
* This interface follows the Repository Pattern to abstract data access. |
| 12 |
*/ |
| 13 |
interface ErrorLogRepositoryInterface |
| 14 |
{ |
| 15 |
/** |
| 16 |
* Save an error log to the database |
| 17 |
* |
| 18 |
* If the ErrorLog has an ID (is persisted), this should update the existing record. |
| 19 |
* If the ErrorLog has no ID (is not persisted), this should create a new record. |
| 20 |
* |
| 21 |
* @param ErrorLog $log The error log entity to save |
| 22 |
* @return void |
| 23 |
*/ |
| 24 |
public function save(ErrorLog $log): void; |
| 25 |
|
| 26 |
/** |
| 27 |
* Find all error logs |
| 28 |
* |
| 29 |
* Returns all error logs ordered by time descending (most recent first). |
| 30 |
* |
| 31 |
* @param int $limit Maximum number of records to retrieve (default: 100) |
| 32 |
* @return ErrorLog[] Array of ErrorLog entities |
| 33 |
*/ |
| 34 |
public function findAll(int $limit = 100): array; |
| 35 |
|
| 36 |
/** |
| 37 |
* Find an error log by ID |
| 38 |
* |
| 39 |
* @param int $id The error log ID |
| 40 |
* @return ErrorLog|null The ErrorLog entity if found, null otherwise |
| 41 |
*/ |
| 42 |
public function findById(int $id): ?ErrorLog; |
| 43 |
|
| 44 |
/** |
| 45 |
* Delete an error log by ID |
| 46 |
* |
| 47 |
* @param int $id The error log ID to delete |
| 48 |
* @return bool True if deleted successfully, false otherwise |
| 49 |
*/ |
| 50 |
public function delete(int $id): bool; |
| 51 |
|
| 52 |
/** |
| 53 |
* Delete all error logs |
| 54 |
* |
| 55 |
* Removes all error log records from the database. |
| 56 |
* |
| 57 |
* @return int The number of records deleted |
| 58 |
*/ |
| 59 |
public function deleteAll(): int; |
| 60 |
} |
| 61 |
|