ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
DatabaseGateway.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24
26{
27 protected \ilDBInterface $db;
28
29 public function __construct(\ilDBInterface $db)
30 {
31 $this->db = $db;
32 }
33
34 public function createDeactivationEntry(SlotIdentifier $slot): void
35 {
36 $this->db->insert(
37 'il_md_vocab_inactive',
38 ['slot' => [\ilDBConstants::T_TEXT, $slot->value]]
39 );
40 }
41
42 public function deleteDeactivationEntry(SlotIdentifier $slot): void
43 {
44 $this->db->manipulate(
45 'DELETE FROM il_md_vocab_inactive WHERE slot = ' .
46 $this->db->quote($slot->value, \ilDBConstants::T_TEXT)
47 );
48 }
49
50 public function doesDeactivationEntryExistForSlot(SlotIdentifier $slot): bool
51 {
52 $res = $this->db->query(
53 'SELECT COUNT(*) AS count FROM il_md_vocab_inactive WHERE slot = ' .
54 $this->db->quote($slot->value, \ilDBConstants::T_TEXT)
55 );
56 if ($row = $res->fetchAssoc()) {
57 return $row['count'] > 0;
58 }
59 return false;
60 }
61}
Interface ilDBInterface.
$res
Definition: ltiservices.php:69