For compatibility with [[hiqdev\hiart\Collection]].

@param $defaultScenario
@param array $data
@param array $options
@return mixed
432654
public function batchQuery($defaultScenario, $data = [], array $options = [])
    {
        $map = [
            'create' => 'create',
            'update' => 'update',
        ];
        $scenario = isset($map[$defaultScenario]) ? $map[$defaultScenario] : $defaultScenario;

        return (new Bill())->batchQuery($scenario, $data, $options);
    }
1289137
public function create($type = null, $data = null, array $options = [])
    {
        if ($type instanceof ResourceInterface) {
            $type = $this->parameterResolver->resolveForm($type);
        }

        $validationGroups = $this->parameterResolver->resolveValidationGroups();
        $translationDomain = $this->parameterResolver->resolveTranslationDomain();

        if (!empty($validationGroups)) {
            $options['validation_groups'] = $validationGroups;
        }

        if (!empty($translationDomain)) {
            $options['translation_domain'] = $translationDomain;
        }

        if ($this->parameterResolver->resolveApi()) {
            $options['csrf_protection'] = false;
        }

        return $this->factory->create($type, $data, $options);
    }
147216
public function read($data, array $options = []) {
		$class = $options['class'];

		$encrypted = $class::read(null, ['strategies' => false]);
		$key = isset($options['key']) ? $options['key'] : null;

		if (!isset($encrypted['__encrypted']) || !$encrypted['__encrypted']) {
			return isset($encrypted[$key]) ? $encrypted[$key] : null;
		}

		$current = $this->_decrypt($encrypted['__encrypted']);

		if ($key) {
			return isset($current[$key]) ? $current[$key] : null;
		} else {
			return $current;
		}
	}
1249843
public function provide($data = null, array $options = [])
    {
        $template = $this->getBasicTemplate('text');
        $defaultOptions = $this->getDefaultOptions($data, $options);
        $defaultOptions['input'] = ['content' => $template];

        $result[$this->config->getField()] = $defaultOptions;

        return $result;
    }
436319
public function insert($data, $options = [])
    {
        return $this->database->createCommand()->insert($this->name, $data, $options);
    }
305966
public function insert(&$data, array $options = array())
    {
        $document = new Document($data, $this);
        $insert = $document->insert($options);
        $data = $document->data;

        return $insert;
    }
941831
public function validate($class, $data, $mode, array $options = [])
    {
        return $this->validator->validate($class, $data, $mode, true, $options);
    }
899384
public function provide($data = null, array $options = [])
    {
        $selectListItems = $this->config->getProvider('selectOptions');
        $selectListItems = new $selectListItems($this->config);
        $listName = $options['fieldDefinitions']->getLimit();

        $selectOptions = $selectListItems->provide($listName, []);
        foreach ($selectOptions as $k => $v) {
            $selectOptions[$k] = sprintf(CountryValueRenderer::ICON_HTML, strtolower($k), $v);
        }

        $options['selectOptions'] = $selectOptions;
        $options['element'] = 'CsvMigrations.FieldHandlers/CountryFieldHandler/input';

        return parent::provide($data, $options);
    }
593224
public function save($data='',$options=array()) {
        if(empty($data)) {
            // 没有传递数据，获取当前数据对象的值
            if(!empty($this->data)) {
                $data           =   $this->data;
                // 重置数据
                $this->data     =   array();
            }else{
                $this->error    =   L('_DATA_TYPE_INVALID_');
                return false;
            }
        }
        // 数据处理
        $data       =   $this->_facade($data);
        if(empty($data)){
            // 没有数据则不执行
            $this->error    =   L('_DATA_TYPE_INVALID_');
            return false;
        }
        // 分析表达式
        $options    =   $this->_parseOptions($options);
        $pk         =   $this->getPk();
        if(!isset($options['where']) ) {
            // 如果存在主键数据 则自动作为更新条件
            if (is_string($pk) && isset($data[$pk])) {
                $where[$pk]     =   $data[$pk];
                unset($data[$pk]);
            } elseif (is_array($pk)) {
                // 增加复合主键支持
                foreach ($pk as $field) {
                    if(isset($data[$field])) {
                        $where[$field]      =   $data[$field];
                    } else {
                           // 如果缺少复合主键数据则不执行
                        $this->error        =   L('_OPERATION_WRONG_');
                        return false;
                    }
                    unset($data[$field]);
                }
            }
            if(!isset($where)){
                // 如果没有任何更新条件则不执行
                $this->error        =   L('_OPERATION_WRONG_');
                return false;
            }else{
                $options['where']   =   $where;
            }
        }

        if(is_array($options['where']) && isset($options['where'][$pk])){
            $pkValue    =   $options['where'][$pk];
        }
        if(false === $this->_before_update($data,$options)) {
            return false;
        }
        $result     =   $this->db->update($data,$options);
        if(false !== $result && is_numeric($result)) {
            if(isset($pkValue)) $data[$pk]   =  $pkValue;
            $this->_after_update($data,$options);
        }
        return $result;
    }
909673
protected function getDefaultOptions($data = null, array $options = []) : array
    {
        $result = [
            'type' => $options['fieldDefinitions']->getType(),
            'label' => $options['label'],
            'operators' => $this->getSearchOperators($data, $options),
            'input' => [
                'content' => '',
            ],
        ];

        return $result;
    }
277924
public function validateNotSame($data, $options, $context) {
		if (!is_array($options)) {
			$options = ['compare' => $options];
		}

		$compareValue = $context['data'][$options['compare']];
		return $compareValue !== $data;
	}
822096
public function provide($data = null, array $options = [])
    {
        $field = $this->config->getField();
        $table = $this->config->getTable();

        $fieldName = $table->aliasField($field);

        $params = [
            'field' => $field,
            'name' => $fieldName,
            'type' => 'url',
            'label' => $options['label'],
            'required' => $options['fieldDefinitions']->getRequired(),
            'value' => $data,
            'extraClasses' => (!empty($options['extraClasses']) ? implode(' ', $options['extraClasses']) : ''),
            'attributes' => empty($options['attributes']) ? [] : $options['attributes'],
            'placeholder' => (!empty($options['placeholder']) ? $options['placeholder'] : ''),
        ];

        $defaultElement = 'CsvMigrations.FieldHandlers/BaseFieldHandler/input';
        $element = empty($options['element']) ? $defaultElement : $options['element'];

        return $this->renderElement($element, $params);
    }
280708
public function trace($url, $data = [], array $options = [])
    {
        $options = $this->_mergeOptions($options);
        $url = $this->buildUrl($url, [], $options);

        return $this->_doRequest(Request::METHOD_TRACE, $url, $data, $options);
    }
8359
public static function parseDefaultOptions($options = [], $defaults = [])
    {
        array_walk($defaults, function ($value, $key) use (&$options) {
            if (!isset($options[$key])) {
                $options[$key] = $value;
            }
        });

        return $options;
    }
1113258
public function body($data = null, $options = []) {
		$default = ['buffer' => null];
		$options += $default;
		$this->body = array_merge((array) $this->body, (array) $data);
		$body = join("\r\n", $this->body);
		return ($options['buffer']) ? str_split($body, $options['buffer']) : $body;
	}
932552
public function insert($collectionName, array $data, array $options = []) {
		$collection = $this->getCollection($collectionName);
		
		if ($this->_profilerEnabled) {
			$message = 'db.' . $collectionName . '.insert(' . json_encode($data) . ');';
			$event   = $this->getProfiler()->startInsert($message);
		}

		$result  = $collection->insert($data, $options);
		$success = (bool) $result['ok'];
		
		if ($this->_profilerEnabled) {
			$success
				? $event->stopSuccess()
				: $event->stopError();
		}
		
		return $success;
	}
239125
public function boolean($data, $default = false, $options = [])
    {

        //check custom filters and flags in options array;
        list($filter, $flags, $parameters) = $this->readFiltersAndFlags(
            $options,
            static::FILTER_BOOLEAN
        );
        //push custom filters and flags from options to their respective array;

        $boolean = $this->scrub($data, $filter, $parameters);

        return (boolean)$boolean;
    }