Delete all models that match condition.
@param string|ModelCondition $condition
@param array $params
@return int
486330
public static function deleteAll($condition, $params = array())
    {
        if (!is_a($condition, '\\mpf\\datasources\\sql\\ModelCondition')) {
            $condition = ModelCondition::getFrom($condition, get_called_class());
        }
        /* @var $condition ModelCondition */
        $condition->setParams($params);
        return static::getDb()->execQuery($condition->forDelete(), $condition->getParams());
    }
1103427
public function delete($conditions = false)
    {
        $this->andWhere($conditions);
        $this->type = self::DELETE;
        return $this->execute();
    }
557770
public static function getFrom($condition, $model) {
        if (is_a($condition, '\\mpf\datasources\\sql\\ModelCondition')) {
            $condition->model = $model;
            return $condition;
        }
        if (is_array($condition) && count($condition))
            $cond = new static($condition);
        else {
            $cond = new static;
            if ($condition)
                $cond->addCondition($condition);
        }
        $cond->model = $model;
        return $cond;
    }
540492
public function destroy($conditions = array())
    {
        $conditions[$this->_property] = $this->_root;
        $this->getRepository()->destroy($conditions);
    }
656361
public function findColumn($condition, $params, $fields) {
		if (!empty($fields)) $this->driver->field($fields);
		return $this->driver->where($condition, $params)
            ->fetchColumn();
	}
609630
public function count(string $condition = '', array $params = array()) {
        $this->model->builder->select('COUNT(*)')
            ->from($this->model->tableName);
        if ($condition) {
            $this->model->builder->where($condition, $params);
        }
        $r = $this->model->builder->query();
        if (!is_array($r) || 0 === count($r)) {
            return false;
        }
        return (int) reset($r[0]);
    }
1224916
public function update($data, $params, $condition = "id")
	{
		$affected = parent::update($data, $params, $condition);
		$this->recache();
		return $affected;
	}
599101
public function many(string $condition = '', array $params = array(), $offset = null, $limit = null) {
        return $this->loadWiths($this->modelManager->many($condition, $params, $offset, $limit));
    }
660003
public function removeCondition(\TechPromux\DynamicQueryBundle\Entity\DataModelCondition $condition)
    {
        $this->conditions->removeElement($condition);
    }
492938
public function buildHashCondition($condition, &$params)
    {
        $parts = [];

        foreach ($condition as $column => $value) {
            if (ArrayHelper::isTraversable($value) || $value instanceof Query) {
                // IN condition
                $parts[] = $this->buildInCondition('IN', [$column, $value], $params);
            }
            else {
                if (strpos($column, '(') === false) {
                    $column = $this->db->quoteColumnName($column);
                }

                if ($value === null) {
                    $parts[] = "$column IS NULL";
                }
                elseif ($value instanceof Expression) {
                    $parts[] = "$column=" . $value->expression;

                    foreach ($value->params as $n => $v) {
                        $params[$n] = $v;
                    }
                }
                else {
                    $phName = self::PARAM_PREFIX . count($params);
                    $parts[] = "$column=$phName";
                    $params[$phName] = $value;
                }
            }
        }

        return count($parts) === 1 ? $parts[0] : '(' . implode(') AND (', $parts) . ')';
    }
772359
public function delete($table, $condition = [], array $options = [])
    {
        $query = $this->createQuery('delete', $table, $options)->where($condition);

        return $this->createRequest($query);
    }
1245098
public static function updateAll ($attributes , $condition = '' , $params = []) {
        $ret = parent::updateAll ($attributes , $condition , $params);
        if ($ret && self::allowFromCache($condition)) {
            $cache_key = self::getCacheKey($condition[static::$pk], true);
            Yii::trace('delete cache:'.$cache_key, __METHOD__);
            static::getCache()->delete($cache_key);
            $cache_key = self::getCacheKey($condition[static::$pk], false);
            static::getCache()->delete($cache_key);
        }
        return $ret;
    }
1050029
public function delete($table, array $conditions)
    {
        $table = $this->getTable($table);
        $where = $this->buildSqlObject($conditions, ' AND ');

        $query = "DELETE FROM $table WHERE " . $where;
        return $this->executeUpdate($query, array_values($conditions));
    }
982456
function removeThis( $conditions = null, $extraConditions = null )
    {
        $this->remove( array( "id" => $this->ID ), $extraConditions );
    }
969875
protected function processCondition($conditions, $params, $types)
    {
        // Regard numeric and null as primary key value
        if (is_numeric($conditions) || empty($conditions)) {
            $conditions = array($this->primaryKey => $conditions);
        }

        if (is_array($conditions)) {
            $where = array();
            $params = array();
            foreach ($conditions as $field => $condition) {
                if (is_array($condition)) {
                    $where[] = $field . ' IN (' . implode(', ', array_pad(array(), count($condition), '?')) . ')';
                    $params = array_merge($params, $condition);
                } else {
                    $where[] = $field . " = ?";
                    $params[] = $condition;
                }
            }
            $conditions = implode(' AND ', $where);
        }

        if ($params !== false) {
            if (is_array($params)) {
                $this->params = array_merge($this->params, $params);
                $this->paramTypes = array_merge($this->paramTypes, $types);
            } else {
                $this->params[] = $params;
                if ($types) {
                    $this->paramTypes[] = $types;
                }
            }
        }

        return $conditions;
    }
505510
public static function find($condition, $params = array())
    {
        if (!is_a($condition, '\\mpf\\datasources\\sql\\ModelCondition'))
            $condition = ModelCondition::getFrom($condition, get_called_class());

        /* @var $condition \mpf\datasources\sql\ModelCondition */
        $oldLimit = $condition->limit;
        $condition->limit = 1;
        $models = static::findAll($condition, $params);
        $condition->limit = $oldLimit;
        return isset($models[0]) ? $models[0] : null;
    }
638281
public function count(string $condition = '', array $params = array()) {
        X::logger()->trace('Redis cached count');
        $key = $this->getCountKey($condition, $params);
        $count = $this->redis()->get($key);
        if (!is_int($count) && !ctype_digit($count)) {
            X::logger()->trace("Miss count $key");
            $count = DirectModelManager::getInstance($this->model)
                ->count($condition, $params);
            $this->set(
                $key,
                $count,
                $this->conf['duration']['count']
            );
            X::logger()->trace("Saved count $key $count");
        } else {
            X::logger()->trace("Hit count $key $count");
            $count = (int) $count;
        }
        return $count;
    }