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.
41 lines
1021 B
41 lines
1021 B
<?php
|
|
|
|
namespace API\script\Gateway;
|
|
|
|
use API\script\Config\Connection;
|
|
use BusinessClass\Keyword;
|
|
|
|
class GatewayKeyword
|
|
{
|
|
private Connection $connection;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->connection = connect();
|
|
}
|
|
|
|
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)
|
|
));
|
|
}
|
|
|
|
public function deleteKeyword(Keyword $keyword)
|
|
{
|
|
$query = "DELETE FROM Keyword WHERE id = :id";
|
|
$this->connection->executeQuery($query, array(
|
|
':id' => array($keyword->getId(), PDO::PARAM_INT)
|
|
));
|
|
}
|
|
|
|
public function getAllKeyword(): array
|
|
{
|
|
$query = "SELECT * FROM Keyword";
|
|
$this->connection->executeQuery($query);
|
|
|
|
return $this->connection->getResults();
|
|
}
|
|
} |