@param string $field
@param string $key
@param Condition|null $condition

@return array
@throws \TypeError
761789
public function getMap(string $field, string $key = 'id', Condition $condition = null): array
    {
        return $this->repository->getMap($field, $key, $condition);
    }
639157
public static function findByKeyfield($keyfield, $status = self::STATUS_ACTIVE)
    {
        if ($status === null) {
            return static::find()->where(['or', ['email' => $keyfield], ['username' => $keyfield]])->limit(1)->one();
        }
        return static::find()->where(['and', ['status' => $status], ['or', ['email' => $keyfield], ['username' => $keyfield]]])->limit(1)->one();
    }
40438
public function hDel($key, $field) {
        return $this->getHandler($this->judge(__FUNCTION__))->hDel($key, $field);
    }
523956
public function hget($key, $field, $default=null) {

        $set = $this->get($key, array());

        return isset($set[$field]) ? $set[$field]:$default;
    }
793012
protected function _buildCondition($property, $condition, $value) {
		switch ($condition) {
			// var = ?
			case self::COND_EQUAL:
				return [$property => $value];
			
			// var in(?)
			case self::COND_IN:
				return [$property => [
					self::MONGO_IN => (array) $value
				]];
			
			// var not in(?)
			case self::COND_NOT_IN:
				return [$property => [
					self::MONGO_NOT_IN => (array) $value
				]];
			
			// var < ?
			case self::COND_LESS:
				return [$property => [
					self::MONGO_LESS => $value
				]];
			
			// var > ?
			case self::COND_MORE:
				return [$property => [
					self::MONGO_MORE => $value
				]];
			
			// var <= ?
			case self::COND_LESS_EQUAL:
				return array($property => array(
					self::MONGO_LESS_EQUAL => $value
				));
			
			// var >= ?
			case self::COND_MORE_EQUAL:
				return [$property => [
					self::MONGO_MORE_EQUAL => $value
				]];
			
			// var != ?
			case self::COND_NOT_EQUAL:
			case self::COND_NOT_EQUAL_ALT:
				return [$property => [
					self::MONGO_NOT_EQUAL => $value
				]];
			
			// var in array(?)
			case self::COND_IN_ARRAY:
				return [$property => [
					self::MONGO_IN_ARRAY => (array) $value
				]];
			
			// var exists(?)
			case self::COND_EXISTS:
				return [$property => [
					self::MONGO_EXISTS => $value
				]];
			
			// var type(?)
			case self::COND_TYPE:
				return [$property => [
					self::MONGO_TYPE => $value
				]];
				
			// var is array()
			case self::COND_IS_ARRAY:
				return [$property => [
					self::MONGO_TYPE => self::MONGO_TYPE_ARRAY
				]];
			
			// var is int()
			case self::COND_IS_INT:
				return [$property => [
					self::MONGO_TYPE => self::MONGO_TYPE_INT32
				]];
			
			// var is string()
			case self::COND_IS_STRING:
				return [$property => [
					self::MONGO_TYPE => self::MONGO_TYPE_STRING
				]];
			
			// var is bool()
			case self::COND_IS_BOOL:
				return [$property => [
					self::MONGO_TYPE => self::MONGO_TYPE_BOOLEAN
				]];
			
			// var is null()
			case self::COND_IS_NULL:
				return [$property => [
					self::MONGO_TYPE => self::MONGO_TYPE_NULL
				]];
			
			// var regexp(?)
			case self::COND_REGEXP:
				return [$property => new MongoRegex($value)];
			
			// var like ?
			case self::COND_LIKE:
				$regex = preg_quote(trim($value, '%'));
				
				if ($value[0] !== '%') {
					$regex = '^' . $regex;
				}
				
				if ($value[strlen($value) - 1] !== '%') {
					$regex .= '$';
				}
				
				return [$property => new MongoRegex('/' . $regex . '/')];
				
			// var array size ?
			case self::COND_ARRAY_COUNT:
			case self::COND_ARRAY_COUNT_ALT:
				return [$property => [
					self::MONGO_SIZE => $value
				]];
			
			default:
				throw new Exception('Uncnown condition: "' . $condition . '"');
		}
	}
1311484
protected function dataModelToArray(\Smile\ElasticsuiteCatalogRule\Model\Data\Condition $condition, $key = 'conditions')
    {
        $output              = [];
        $output['type']      = $condition->getConditionType();
        $output['value']     = $condition->getValue();
        $output['attribute'] = $condition->getAttributeName();
        $output['operator']  = $condition->getOperator();

        if ($condition->getAggregatorType()) {
            $output['aggregator'] = $condition->getAggregatorType();
        }
        if ($condition->getConditions()) {
            $conditions = [];
            foreach ($condition->getConditions() as $subCondition) {
                $conditions[] = $this->dataModelToArray($subCondition, $key);
            }
            $output[$key] = $conditions;
        }

        return $output;
    }
1250908
public function errors(string $field = null)
    {
        if ($field !== null) {
            return $this->_errors[$field] ?? false;
        }

        return $this->_errors;
    }
1232334
public function addFieldToFilter($field, $condition = null)
    {
        if ($field === 'store_id') {
            return $this->addStoreFilter($condition, false);
        }

        return parent::addFieldToFilter($field, $condition);
    }
42823
public function addField(Field $field, Key $key = null)
    {
        if (null !== $key) {
            $field->setKey($key);
        }
        
        $this->fields[$field->getName()] = $field;

        return $this;
    }
1199956
public function canMap(Field $field)
    {
        return
            $field->type instanceof FieldType\MultipleStringField ||
            $field->type instanceof FieldType\TextField ||
            $field->type instanceof FieldType\FullTextField;
    }
843493
public function column($field, $key = '')
    {
        $result = false;
        if (isset($this->options['field'])) {
            unset($this->options['field']);
        }
        if ($key && '*' != $field) {
            $field = $key . ',' . $field;
        }
        $cursor = $this->field($field)->fetchCursor(true)->select();
        $cursor->setTypeMap(['root' => 'array']);
        $resultSet = $cursor->toArray();
        if ($resultSet) {
            $fields = array_keys($resultSet[0]);
            $count  = count($fields);
            $key1   = array_shift($fields);
            $key2   = $fields ? array_shift($fields) : '';
            $key    = $key ?: $key1;
            foreach ($resultSet as $val) {
                $name = $val[$key];
                if ($name instanceof ObjectID) {
                    $name = $name->__toString();
                }
                if (2 == $count) {
                    $result[$name] = $val[$key2];
                } elseif (1 == $count) {
                    $result[$name] = $val[$key1];
                } else {
                    $result[$name] = $val;
                }
            }
        } else {
            $result = [];
        }
        return $result;
    }
35316
protected function setAttribute( string$key, string$value, string$condition=null ):self
	{
		if( isset($this->attributes[$key]) )
			{ $this->document->throw("Attribute $key of $this->name cannot redeclare."); }

		$this->attributes[$key]=[
			'value'=> $value,
			'condition'=> $condition,
		];

		return $this;
	}
910729
public function stateId(array $condition, array $data, $key)
    {
        // Check form fields
        if (isset($data['data']['address']['state_id'])) {
            $state_id = $data['data']['address']['state_id'];
            return $this->compare($state_id, $condition['value'], $condition['operator']);
        }

        if (!isset($data['data']['order'][$key])) {
            return false;
        }

        $address = $this->address->get($data['data']['order'][$key]);

        if (empty($address['state_id'])) {
            return false;
        }

        return $this->compare($address['state_id'], $condition['value'], $condition['operator']);
    }
1079518
public function where($key, $constraint = null, $value = null, $condition = 'AND')
    {
        $handle = $this->getHandle();

        $this->_internal_query->where($key, $constraint, $value, $condition);

        if (!isset($this->_parent_query->where[$handle])) {
            $this->_parent_query->where[$handle] = array('clause' => $this, 'condition' => $this->_condition);
        }

        return $this;
    }
310247
public function where($key, $condition = null, $value = null)
    {
        if (!is_null($condition) && is_null($value)) {
            $value = $condition;
            $condition = '=';
        }

        if (count($this->_conditions) < 1) {
            array_push($this->_conditions, []);
        }
        return $this->makeWhere($key, $condition, $value);
    }
354954
public function hget($key, $field)
    {
        $this->init();
        $result = $this->driver->hget($key, $field);
        return $this->convertFalseToNull($result);
    }
1151609
public function when($condition, $fields)
    {
        $this->getChildren()->mergeSchema([
            $this->normalizeCondition($condition) => $fields,
        ]);

        return $this;
    }