feat: update error handling logic

This commit is contained in:
2025-04-13 22:18:14 +01:00
parent 46c6dd6e58
commit 54c2c8e897
4 changed files with 29 additions and 5 deletions

View File

@@ -19,7 +19,7 @@ class TaskRepository implements TaskDao
$this->conn = $connection->getConnection();
}
public function create(Task $task): bool
public function create(Task $task): int
{
$data = $task->persist();
$stmt = $this->conn->prepare(
@@ -35,8 +35,11 @@ class TaskRepository implements TaskDao
$stmt->bindParam(7, $data['end']);
$stmt->bindParam(8, $data['status_id']);
if ($stmt->execute()) {
return (int) $this->conn->lastInsertId();
}
return $stmt->execute();
return 0;
}
public function readAll(): array