无则插入,有则忽略

@param array $row
@return number string
179373
public function insertIgnore(array $row)
    {
        // 这两个字段是表必备字段,并自动更新
        $row = self::appendAutoField($row);

        // 执行前置钩子
        $ret = $this->before('Insert', 'InsertIgnore', $row);
        if ($ret === self::INTERRUPT) {
            return null;
        }
        $row = array_pop($ret);

        //Insert/Replace/InsertIgnore的后继处理
        return self::afterInsertReplaceInsertIgnore('InsertIgnore', $row);
    }
635684
private function _getWhere($row)
    {
        $where = array();
        foreach ($this->_groupBy as $k=>$field) {
            if (is_array($field)) {
                $values = $field;
                $field = $k;
                $valueFound = false;
                foreach ($values as $value) {
                    if ($row->$field == $value) {
                        $valueFound = true;
                        if (is_null($value)) {
                            $where[] = "ISNULL($field)";
                        } else {
                            $where["$field = ?"] = $value;
                        }
                        break;
                    }
                }
                if (!$valueFound) {
                    $in = array();
                    foreach ($values as $value) {
                        $in[] = $row->getTable()->getAdapter()->quote($value);
                    }
                    $in = implode(',', $in);
                    $where[] = "$field NOT IN ($in)";
                }
            } else {
                if (is_null($row->$field)) {
                    $where[] = "ISNULL($field)";
                } else {
                    $where["$field = ?"] = $row->$field;
                }
            }
        }
        return $where;
    }
836965
public function getString($row, Table $table) {
        if (!$this->isVisible($row)) {
            return "";
        }
        $options = $this->htmlOptions;
        if ($this->title != "") {
            eval("\$options['title'] = {$this->title};");
        } elseif (!isset($options['title'])) {
            $options['title'] = '';
        }
        if ($this->confirmation && (!$this->post)) {
            if ($this->jsAction) {
                $options['onclick'] = "if (confirm('{$this->confirmation}')) {$this->jsAction}({$row->{$this->dataProvider->getPkKey()}}, '{$this->name}', this);";
            } else {
                $options['onclick'] = "return confirm('{$this->confirmation}');";
            }
        } elseif ($this->jsAction) {
            $options['onclick'] = "return {$this->jsAction}({$row->id}, '{$this->name}', this);";
        }

        if ('#' != $this->url) {
            eval("\$url = {$this->url};");
        } else {
            $url = '#';
        }
        if (false !== $this->post && is_array($this->post)) {
            $options['class'] = isset($options['class']) ? $options['class'] . ' mdata-table-post-link' : 'mdata-table-post-link';
            $parsed = array();
            foreach ($this->post as $name=>$value){
                eval('$value = '. $value.';');
                if ('{{modelKey}}' == $name){
                    $name = $table->dataProvider->filtersKey;
                }
                $parsed[$name] = $value;
            }
            $options['post-data'] = json_encode($parsed);
            if ($this->confirmation){
                $options['post-confirmation'] = $this->confirmation;
            }
        }
        $icon = $this->getIcon($options['title'], $table);
        return Html::get()->link($url, $icon . $this->label, $options);
    }
1321053
protected function _formatRow(array $row) {
        $out = '';
        foreach ($row as $key => $value) {
            if (is_array($value)) {
                // This is the case with hasMany and hasAndBelongsToMany related
                // rowsets.
                $value = $this->_formatRelatedRowset($value);
            }
            $out .= "$key: $value\n";
        }
        return $out;
    }
1348684
public function quoteSetValues(array $row): string
    {
        $values = [];
        foreach ($row as $key => $value) {
            if ($value instanceof RawExp) {
                $values[] = $this->quoteName($key) . '=' . $value->getValue();
                continue;
            }
            $values[] = $this->quoteName($key) . '=' . $this->quoteValue($value);
        }

        return implode(', ', $values);
    }
646374
protected function getReferences(array $row){
		$references = [];
		$types      = [];

		foreach($row as &$field){
			$type = gettype($field);

			if($type === 'integer'){
				$types[] = 'i';
			}
			elseif($type === 'double'){
				$types[] = 'd';
			}
			else{
				$types[] = 's';
			}

			$references[] = &$field;
		}

		array_unshift($references, implode('', $types));

		return $references;
	}
1278330
private function decode(array $row): ?array
    {
        if (null === ($encoded = $row[$this->name()])) {
            return null;
        }

        if (false === ($decoded  = unserialize($encoded, ['allowed_classes' => false]))) {
            return null;
        }
        if (!\is_array($decoded)) {
            return null;
        }

        return $decoded;
    }
1226469
private function processInsertOperation(array $row): int
    {
        //准备语句
        $this->statement->insert($row);

        //检查是否需要记录数据库日志
        $operationLog = self::logEnabled();

        if (!$operationLog) {
            //不需要记录,直接执行
            $this->execute2();

            // 获取插入的记录的ID,执行后置钩子
            return $this->after('Insert', 'Insert', $this->getInsertedId());
        }

        //执行原始操作
        $this->execute2();

        //获取插入的记录的ID
        $id = $this->getInsertedId();

        //判断插入是否成功
        if ($id) {
            //重新取出插入的数据
            $after = $this->select2('*', $id,null,1);

            //记录日志
            call_user_func($operationLog, $this->tableName, 'insert', ['data' => $row, 'after' => $after]);
        } else {
            //记录日志
            call_user_func($operationLog, $this->tableName, 'insert', ['data' => $row, 'id' => '插入失败']);
        }

        // 获取插入的记录的ID,执行后置钩子
        return $this->after('Insert', 'Insert', $id);
    }
218161
protected function getArray($row)
    {
        if (!$row instanceof Traversable && !is_array($row)) {
            throw new InvalidArgumentException("The input is not an array or traversable");
        }
        return ($row instanceof Traversable) ? iterator_to_array($row, true) : $row;
    }
66917
protected function appendNull(array $row, string $fields): array
    {
        // 这就不用附加了
        if ($fields == '*') {
            return $row;
        }

        // 分解为数组
        $fieldsArr = explode(',', $fields);
        foreach ($fieldsArr as $k) {
            // 处理AS别名问题
            $matched = preg_match('/\sas\s(.*)/i', $k, $matches);
            if ($matched) {
                $k = $matches[1];
            }
            $k = trim($k, '`');

            // 如果本表已经有此字段,则不扩展
            if (!array_key_exists($k, $row)) {
                // 扩展值为空,因为没有对应
                $row[$k] = '';
            }
        }
        return $row;
    }
35539
protected function cleanupRow($row)
    {
        foreach ($row as $key => $column) {
            if ($this->isQuoted($column)) {
                $column = $this->unescape($this->unquote($column));
            }
            if ($this->isSerialized($column)) {
                $column = $this->unserialize($column);
            }
            if ('N;' === $column) {
                $column = null;
            }
            $row[$key] = $column;
        }

        return $row;
    }
495070
public function getValue(array $row, array $rows = [])
    {
        if (isset($row[$this->getName()])) {
            $rawValue = $row[$this->getName()];
        } else {
            $rawValue = null;
        }
        // if a callback is set
        $callback = $this->getDisplayCallback();
        if (!is_null($callback)) {
            if (!is_callable($callback)) {
                throw new \Exception('displayCallback is not callable');
            }

            return $callback($rawValue, $row, $rows);
        } else {
            switch ($this->getDisplayFormat()) {
                case static::FORMAT_DATE:
                    $formatParams = $this->getDisplayFormatParams();
                    if (is_null($formatParams)) {
                        $formatParams = 'Y-m-d H:i:s';
                    }
                    if (!is_null($rawValue) && is_object($rawValue) && get_class($rawValue) == 'DateTime') {
                        return $rawValue->format($formatParams);
                    } else {
                        return '';
                    }
                    break;
                case static::FORMAT_TEXT:
                default:
                    if (is_array($rawValue)) {
                        return implode(',', $rawValue);
                    } else {
                        return $rawValue;
                    }
                    break;
            }
        }
    }
274685
public function getHighestColumn($row = null)
    {
        if ($row == null) {
            $colRow = $this->getHighestRowAndColumn();
            return $colRow['column'];
        }

        $columnList = array(1);
        foreach ($this->getCellList() as $coord) {
            sscanf($coord, '%[A-Z]%d', $c, $r);
            if ($r != $row) {
                continue;
            }
            $columnList[] = PHPExcel_Cell::columnIndexFromString($c);
        }
        return PHPExcel_Cell::stringFromColumnIndex(max($columnList) - 1);
    }
248264
public function getValue($row): string
    {
        $escape = $this->get('escape', false);
        $value = $this->attributes['value']($row);

        if ($value instanceof Renderable) {
            return $value->render();
        }

        return $escape === true ? e($value) : $value;
    }
99545
public function insert(array $row): ?int
    {
        // 这两个字段是表必备字段,并自动更新
        $row = array_filter(self::appendAutoField($row));

        // 执行前置钩子
        $ret = $this->before('Insert', 'Insert', $row);
        if ($ret === self::INTERRUPT) {
            return null;
        }
        $row = array_pop($ret);

        //Insert/Replace/InsertIgnore的后继处理
        return self::afterInsertReplaceInsertIgnore('Insert', $row);
    }
397430
private function write(array $row)
    {
        if ($this->encodingFrom !== null && $this->encodingTo !== null) {
            foreach ($row as $k => $v) {
                $row[$k] = iconv($this->encodingFrom, $this->encodingTo, $v);
            }
        }

        return fputcsv($this->handle, $row, $this->delimiter, $this->enclosure, $this->escape);
    }
207455
public function getDataCellContent($row)
	{
		$data=$this->grid->dataProvider->data[$row];
		if($this->value!==null)
			$value=$this->evaluateExpression($this->value,array('data'=>$data,'row'=>$row));
		elseif($this->name!==null)
			$value=CHtml::value($data,$this->name);
		else
			$value=$this->grid->dataProvider->keys[$row];

		$checked = false;
		if($this->checked!==null)
			$checked=$this->evaluateExpression($this->checked,array('data'=>$data,'row'=>$row));

		$options=$this->checkBoxHtmlOptions;
		if($this->disabled!==null)
			$options['disabled']=$this->evaluateExpression($this->disabled,array('data'=>$data,'row'=>$row));

		$name=$options['name'];
		unset($options['name']);
		$options['value']=$value;
		$options['id']=$this->id.'_'.$row;
		return CHtml::checkBox($name,$checked,$options);
	}