Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
OrmDataManager.php
1<?php
3
5
7{
8 public static function deleteByFilter(array $filter): Main\Orm\Data\DeleteResult
9 {
10 $entity = static::getEntity();
11 $sqlTableName = static::getTableName();
12 $sqlHelper = $entity->getConnection()->getSqlHelper();
13
14 $where = Main\ORM\Query\Query::buildFilterSql($entity, $filter);
15 $result = new Main\Orm\Data\DeleteResult();
16 if ($where !== '')
17 {
18 $sql = "DELETE FROM {$sqlHelper->quote($sqlTableName)} WHERE " . $where;
19 $entity->getConnection()->queryExecute($sql);
20 $result->setData(['rowsCount' => $entity->getConnection()->getAffectedRowsCount()]);
21 }
22 return $result;
23 }
24}