45 $sqlTableName = static::getTableName();
46 $sqlHelper =
$entity->getConnection()->getSqlHelper();
47 $filter = [
'ITEM_ID' => $itemId,
'USER_ID' => $userId];
49 $where = Main\ORM\Query\Query::buildFilterSql(
$entity, $filter);
52 $sql =
"DELETE FROM {$sqlHelper->quote($sqlTableName)} WHERE " . $where;
53 $entity->getConnection()->queryExecute($sql);
58 $filter = [
'=USER_ID' => $userId];
59 $records = static::getList([
62 'limit' => $counter + 1,
67 if (count($records) > $counter)
69 $lastRecord = end($records);
70 $filter[
'<ID'] = $lastRecord[
'ID'];
71 $where = Main\ORM\Query\Query::buildFilterSql(
$entity, $filter);
74 $sql =
"DELETE FROM {$sqlHelper->quote($sqlTableName)} WHERE " . $where;
75 $entity->getConnection()->queryExecute($sql);