You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SAE4.01_FORMULAIRE/Source/API/script/Gateway/GatewayKeyword.php

44 lines
1.1 KiB

<?php
namespace API\Gateway;
use BusinessClass\Keyword;
use Connection;
class GatewayKeyword
{
private Connection $connection;
public function __construct(Connection $connection)
{
$this->connection = $connection;
}
public function insertKeyword(Keyword $keyword)
{
$query = "INSERT INTO Keyword(id, word) VALUES(:id, :word)";
$this->connection->executeQuery($query, array(
':id' => array($keyword->getId(), PDO::PARAM_INT),
':word' => array($keyword->getWord(), PDO::PARAM_INT)
));
$this->connection->executeQuery();
}
public function deleteKeyword(Keyword $keyword)
{
$query = "DELETE FROM Keyword WHERE id = :id";
$this->connection->executeQuery($query, array(
':id' => array($keyword->getId(), PDO::PARAM_INT)
));
$this->connection->executeQuery();
}
public function getAllKeyword(): array
{
$query = "SELECT * FROM Keyword";
$this->connection->executeQuery($query);
$this->connection->executeQuery();
return $this->connection->getResults();
}
}