parent
e5c8d75d6f
commit
454e643825
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace API\Gateway;
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue