mirror of
https://github.com/Aviortheking/Blog_IMIE.git
synced 2025-06-15 03:29:19 +00:00
finalisation de ma part :)
This commit is contained in:
@ -12,7 +12,7 @@ class Author {
|
||||
|
||||
private $password;
|
||||
|
||||
private $job;
|
||||
private $job = "Aprenant";
|
||||
|
||||
private $role = "ROLE_USER";
|
||||
|
||||
@ -134,15 +134,16 @@ class Author {
|
||||
}
|
||||
|
||||
public static function remove(Author $author) {
|
||||
Functions::connect()->prepare("DELETE FROM author WHERE id=:id")->execute(array(":id" => $author->getId()));
|
||||
Functions::connect()->prepare("DELETE FROM users WHERE id=:id")->execute(array(":id" => $author->getId()));
|
||||
|
||||
}
|
||||
|
||||
public static function update(Author $author) {
|
||||
Functions::connect()->prepare("UPDATE author SET name=':name', password=':password', job=':job' WHERE id=:id")->execute(array(
|
||||
Functions::connect()->prepare("UPDATE users SET username=:username, password=:password, job=:job, role=:role WHERE id=:id")->execute(array(
|
||||
":username" => $author->getUsername(),
|
||||
":password" => $author->getPassword(),
|
||||
":job" => $author->getJob(),
|
||||
":role" => $author->getRole(),
|
||||
":id" => $author->getId()
|
||||
));
|
||||
}
|
||||
|
@ -286,7 +286,16 @@ class Post {
|
||||
*
|
||||
*/
|
||||
public static function remove(Post $post) {
|
||||
Functions::connect()->prepare("DELETE FROM posts WHERE id=:id")->execute(array(":id" => $post->getId()));
|
||||
|
||||
$id = $post->getId();
|
||||
|
||||
$prepared = Functions::connect()->prepare("DELETE FROM post_tag WHERE post_id=:id");
|
||||
$prepared->bindValue(":id", $id, PDO::PARAM_INT);
|
||||
$prepared->execute();
|
||||
|
||||
$prepared = Functions::connect()->prepare("DELETE FROM posts WHERE id=:id");
|
||||
$prepared->bindValue(":id", $id, PDO::PARAM_INT);
|
||||
$prepared->execute();
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user