19 declare(strict_types=1);
39 $query =
"SELECT * FROM " . self::TABLE_NAME .
" WHERE sender_id = " . $this->db->quote(
44 $result = $this->db->query($query);
47 while ($row = $this->db->fetchAssoc($result)) {
48 $auto_responder_results->add(
50 (
int) $row[
'sender_id'],
51 (
int) $row[
'receiver_id'],
57 return $auto_responder_results;
62 $query =
"SELECT * FROM " . self::TABLE_NAME .
" WHERE receiver_id = " . $this->db->quote(
67 $result = $this->db->query($query);
70 while ($row = $this->db->fetchAssoc($result)) {
71 $auto_responder_results->add(
73 (
int) $row[
'sender_id'],
74 (
int) $row[
'receiver_id'],
80 return $auto_responder_results;
88 $query =
"SELECT * FROM " . self::TABLE_NAME .
" WHERE sender_id = " . $this->db->quote(
92 $result = $this->db->query($query);
93 $row = $this->db->fetchAssoc($result);
96 "No auto responder found for sender_id: " . $sender_id .
" and receiver_id: " . $receiver_id
101 (
int) $row[
'sender_id'],
102 (
int) $row[
'receiver_id'],
126 $this->db->manipulate(
127 'DELETE FROM ' . self::TABLE_NAME .
' WHERE sender_id = ' . $this->db->quote(
128 $auto_responder->getSenderId(),
136 $this->db->manipulate(
137 'DELETE FROM ' . self::TABLE_NAME .
' WHERE sender_id = ' . $this->db->quote(
144 public function exists(
int $sender_id,
int $receiver_id): bool
146 $query =
"SELECT 1 existing_record FROM " . self::TABLE_NAME .
" WHERE sender_id = " . $this->db->quote(
150 $result = $this->db->query($query);
152 if ($row = $this->db->fetchAssoc($result)) {
153 return (
int) $row[
'existing_record'] === 1;
__construct(protected ilDBInterface $db)
findByReceiverId(int $receiver_id)
exists(int $sender_id, int $receiver_id)
findBySenderId(int $sender_id)
findBySenderIdAndReceiverId(int $sender_id, int $receiver_id)
store(AutoresponderDto $auto_responder)
deleteBySenderId(int $sender_id)