19 declare(strict_types=1);
44 $this->db = $DIC->database();
45 $this->usr_id = $a_usr_id;
53 if (!isset(self::$instances[$a_usr_id])) {
54 self::$instances[$a_usr_id] =
new self($a_usr_id);
56 return self::$instances[$a_usr_id];
66 return array_key_exists(
"{$server_id}:{$a_mid}", $this->consents);
69 public function delete():
void 71 foreach ($this->consents as $mid => $consent) {
77 public function add(
int $server_id,
int $a_mid): void
82 $this->consents[
"{$server_id}:{$a_mid}"] = $consent;
86 protected function read(): void
88 $query =
'SELECT * FROM ecs_user_consent ' .
89 'WHERE usr_id = ' . $this->db->quote(
93 $res = $this->db->query($query);
97 (
int) $row->server_id,
hasConsented(int $server_id, int $a_mid)
__construct(int $a_usr_id)
static getInstanceByUserId(int $a_usr_id)
add(int $server_id, int $a_mid)