Delete items from the model

@param mixed $filter True to use the stored filter, array to specify a different filter
@return int The number of items deleted
171564
public function delete($filter = true)
    {
        $rows = $this->load($filter);

        foreach ($rows as $row) {
            $name  = $this->getModelNameForRow($row);
            $field = $row['gtf_id_field'];

            if (self::FIELDS_NAME === $name) {
                $this->db->delete(
                        'gems__respondent2track2field',
                        $this->db->quoteInto('gr2t2f_id_field = ?', $field)
                        );

            } elseif (self::APPOINTMENTS_NAME === $name) {
                $this->db->delete(
                        'gems__respondent2track2appointment',
                        $this->db->quoteInto('gr2t2a_id_app_field = ?', $field)
                        );
            }
        }

        return parent::delete($filter);
    }
702693
public static function getCategoriesCount($filter = array())
    {
        $filter = Filter::create($filter);
        return self::getCount('/categories/count' . $filter->toQuery());
    }
33073
protected function getFilterParams(array &$filters, $filter)
    {
        $fragments = preg_split('%;%', $filter, -1, PREG_SPLIT_NO_EMPTY);

        $name = array_shift($fragments);
        $params = [];

        foreach ($fragments as $param) {
            list($key, $value)  = explode('=', $param);
            $params[$key] = $value;
        }

        $filters[$name] = $params;
    }
1021644
public function indexOf($filter)
    {
        foreach ($this->children as $i => $child) {
            if ($child === $filter) {
                return $i;
            }
        }

        return -1;
    }
1163865
public function delete($namespace, $filter)
    {
        $bulk = new BulkWrite();

        try {
            $bulk->delete($filter);
        } catch (\Exception $exception) {
            throw new MongodbException($exception->getMessage(), $exception->getCode(), $exception);
        }

        return $this->bulkWrite($namespace, $bulk)->getDeletedCount();
    }
1303239
protected function setFilter(string $filter)
    {
        $user = $this->getBackendUser();
        $validFilter = ['all', 'cached', 'notCached'];
        if ('' === $filter) {
            $filter = (string)$user->getSessionData('sfc_filter');
        }
        if (!\in_array($filter, $validFilter, true)) {
            $filter = 'all';
        } else {
            $user->setAndSaveSessionData('sfc_filter', $filter);
        }

        return $filter;
    }
1073029
public function auto_filter($filter = true)
	{
		if (func_num_args() == 0)
		{
			return $this->auto_filter;
		}

		$this->auto_filter = $filter;

		return $this;
	}
1345694
public static function del($dir, $filter = '')
    {
        $files = new \DirectoryIterator($dir);
        foreach ($files as $file) {
            if ($file->isDot()) {
                continue;
            }
            $filename = $file->getFilename();
            if (!empty($filter) && !\preg_match($filter, $filename)) {
                continue;
            }
            if ($file->isDir()) {
                self::del($dir . DS . $filename);
            } else {
                \unlink($dir . DS . $filename);
            }
        }
        return \rmdir($dir);
    }
223577
public function AddFilter( $filter )
	{
		$this->filters[] = $filter;

		if ( count( $this->filters ) <= 1 ) return;

		usort( $this->filters, function( /** @var Filter $a */ $a, /** @var Filter $b */ $b )
		{
			return $a->sortPriority > $b->sortPriority
				? 1
				: ( $a->sortPriority < $b->sortPriority ? -1 : 0 );
		} );
	}
412717
public static function getItems($filter = []): array
    {
        $res = [];

        /* @var $class LightModel */
        $className = get_called_class();
        $class = new $className;

        $sql = 'SELECT * FROM ' . $class->getTableName() . ' WHERE 1=1';
        $params = self::handleFilter($sql, $filter, $class);

        $query = DB::getConnection()->prepare($sql);
        $query->execute($params);

        foreach ($query->fetchAll(PDO::FETCH_CLASS, $className) as $item)
        {
            $res[] = self::typeCastModel($item);
        }

        return $res;
    }
1120823
public function remove($filter)
    {
        $index = $this->indexOf($filter);

        if ($index > -1) {
            $this->offsetUnset($index);
        }

        return $this;
    }
365006
public function getFilter($filter)
    {
        $result = null;

        if(isset($this->__filters[$filter])) {
            $result = $this->__filters[$filter];
         }

        return $result;
    }
51392
protected function handle($item, callable $filter = null)
    {
        if (null !== $filter) {
            return call_user_func($filter, $item);
        }
        return $item;
    }
1224430
public function deleteMany(array $filter, array $options = [])
    {
        list($bulkOptions, $options) = self::extractBulkWriteOptions($options);
        $model = new DeleteMany($filter, $options);
        $bulkWriteResult = $this->bulkWrite([$model], $bulkOptions);

        return new DeleteResult($bulkWriteResult);
    }
431331
public function findOneAndDelete(array $filter, array $options = [])
    {
        $options = ['remove' => true] + FindOneAndDeleteResolver::resolveStatic($options);

        return $this->findAndModify($filter, $options);
    }
495551
public static function convertFilter($filter)
    {
        if (!$filter) {
            return array();
        }
        if (is_array($filter)) {
            return $filter;
        }

        $filter_array = array();
        $rules        = explode('|', $filter);
        foreach ($rules as $rule) {
            list($name, $arg) = self::get_name_and_arg($rule);
            $filter_array[$name] = $arg;
        }

        return $filter_array;
    }
25397
public function deleteOne(array $filter, array $options = [])
    {
        list($bulkOptions, $options) = self::extractBulkWriteOptions($options);
        $model = new DeleteOne($filter, $options);
        $bulkWriteResult = $this->bulkWrite([$model], $bulkOptions);

        return new DeleteResult($bulkWriteResult);
    }