changed return to bool on update and delete
This commit is contained in:
parent
24c8a3d9d7
commit
e2bf38299b
|
@ -137,7 +137,7 @@ class UserRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function update(User $user): bool|int
|
public function update(User $user): bool
|
||||||
{
|
{
|
||||||
$id = $user->getId();
|
$id = $user->getId();
|
||||||
$nick = $user->getNick();
|
$nick = $user->getNick();
|
||||||
|
@ -169,9 +169,7 @@ class UserRepository
|
||||||
$statement->bindParam(param: 'first', var: $first);
|
$statement->bindParam(param: 'first', var: $first);
|
||||||
$statement->bindParam(param: 'last', var: $last);
|
$statement->bindParam(param: 'last', var: $last);
|
||||||
$statement->bindParam(param: 'is_admin', var: $isAdmin);
|
$statement->bindParam(param: 'is_admin', var: $isAdmin);
|
||||||
$statement->execute();
|
return $statement->execute();
|
||||||
|
|
||||||
return $statement->rowCount();
|
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
echo $e->getMessage();
|
echo $e->getMessage();
|
||||||
return false;
|
return false;
|
||||||
|
@ -179,7 +177,7 @@ class UserRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function delete(User $user): int
|
public function delete(User $user): bool
|
||||||
{
|
{
|
||||||
$sql = "
|
$sql = "
|
||||||
DELETE FROM " . DatabaseConnection::TABLE_USERS . "
|
DELETE FROM " . DatabaseConnection::TABLE_USERS . "
|
||||||
|
@ -189,9 +187,7 @@ class UserRepository
|
||||||
$statement = $this->databaseConnection->getConnection()->prepare(query: $sql);
|
$statement = $this->databaseConnection->getConnection()->prepare(query: $sql);
|
||||||
$id = $user->getId();
|
$id = $user->getId();
|
||||||
$statement->bindParam(param: 'id', var: $id);
|
$statement->bindParam(param: 'id', var: $id);
|
||||||
$statement->execute();
|
return $statement->execute();
|
||||||
|
|
||||||
return $statement->rowCount();
|
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
exit($e->getMessage());
|
exit($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue