47 $sqlTableName = static::getTableName();
48 $sqlHelper =
$entity->getConnection()->getSqlHelper();
49 $filter = [
'ITEM_ID' => $itemId,
'USER_ID' => $userId];
51 $where = Main\ORM\Query\Query::buildFilterSql(
$entity, $filter);
54 $sql =
"DELETE FROM {$sqlHelper->quote($sqlTableName)} WHERE " . $where;
55 $entity->getConnection()->queryExecute($sql);
60 $filter = [
'=USER_ID' => $userId];
61 $records = static::getList([
64 'limit' => $counter + 1,
69 if (count($records) > $counter)
71 $lastRecord = end($records);
72 $filter[
'<ID'] = $lastRecord[
'ID'];
73 $where = Main\ORM\Query\Query::buildFilterSql(
$entity, $filter);
76 $sql =
"DELETE FROM {$sqlHelper->quote($sqlTableName)} WHERE " . $where;
77 $entity->getConnection()->queryExecute($sql);