feat: update error handling logic
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user