1
0
mirror of https://github.com/nextcloud/ocsms.git synced 2026-08-15 02:12:54 +00:00

Prepare to get conversation number on write

This commit is contained in:
Loic Blot
2018-05-17 09:31:55 +02:00
parent 7bd0ea3af3
commit e63237283f
2 changed files with 20 additions and 3 deletions
+11 -1
View File
@@ -308,6 +308,16 @@ class SmsMapper extends Mapper {
return $phoneList;
}
private function getConversationForUserAndPhone($userId, $phoneNumber) {
$qb->select('id')
->from('ocsms_conversations')
->where($qb->expr()->andX(
$qb->expr()->eq('user_id', $qb->createNamedParameter($userId)),
$qb->expr()->in('phone_number', $qb->createNamedParameter($phoneNumber))
);
$result = $qb->execute();
}
public function writeToDB ($userId, $smsList, $purgeAllSmsBeforeInsert = false) {
$this->db->beginTransaction();
$qb = $this->db->getQueryBuilder();
@@ -348,7 +358,7 @@ class SmsMapper extends Mapper {
(int) $sms["type"]
));
$this->getConversationForUserAndPhone($userId, $sms["address"]);
}
$this->db->commit();