Get the value that will be inserted into the database
@param array $data Most likely refer to $_POST
@return null
356175
public function getStoreValue($data = null)
    {

        // If Overrite Value
        if (isset($this->value) && $this->overwriteValue) {
            return $this->value;
        }

        // If user have user input value
        if ($data != null && isset($data[$this->getName()])) {

            // Process the value by FieldType
            // For example, HTML5's datetime-local is unable insert into the database directly. So the DateTimeLocal have to convert it to the proper format.
            return $this->fieldType->beforeStoreValue($data[$this->getName()]);
        }

        return $this->value;
    }
1260791
protected function insert(array $data = array())
    {
        $fields = array();
        $values = array();
        
        foreach ($data as $field => $value) {
            $fields[] = $field;
            $values[] = '?';
        }
        
        $sql = "INSERT INTO $this->_table " 
                . "(" . implode(', ', $fields) . ")"
                . "VALUES (" . implode(', ', $values) . ")";
                
        $pdos = $this->_pdo->prepare($sql);
        
        $pdos->execute(array_values($data));
        
        return $pdos->statement()->rowCount();
    }
1357048
private function getValue($steps, array $data)
    {
        $value = $data;
        foreach (explode('.', $steps) as $step) {
            if (!\array_key_exists($step, $value)) {
                return null;
            }

            $value = $value[$step];
        }

        return $value;
    }
535982
public static function fromArray(array $data)
    {
        $result = '';
        foreach ($data as $name => $value) {
            $value = StringHelper::toString($value, "'", Serialize::SERIALIZE_JSON);
            $result .= "$name=$value; ";
        }

        return $result === '' ? null : rtrim($result);
    }
763957
function insert($data)
    {
        $field = "";
        $values = "";

        foreach($data as $key => $value)
        {
            $value = $this->db->quote($value);
            $field = $field . "`$key`,";
            $values = $values . "'$value',";
        }

        $field = substr($field, 0, -1);
        $values = substr($values, 0, -1);
        return $this->db->query("insert into {$this->table} ($field) values($values)");
    }
130656
protected function _insert(array $data)
    {
        $data = $this->_setData($data);
        $sql = Sql::createSql($this->getAdapter())->insert($this->getTableName());
        $event = new Save([
            'action' => Save::INSERT,
            'data' => $data,
            'abort' => false
        ]);
        $this->getEventManager()->trigger(Save::BEFORE_SAVE, $this, $event);
        if ($event->abort) {
            return false;
        }
        $result = $sql->set($event->data)->execute();

        if ($result > 0) {
            $pmk = $this->getPrimaryKey();
            $this->$pmk = $this->getAdapter()->getLastInsertId();
            $this->getEventManager()->trigger(Save::AFTER_SAVE, $this, $event);
        }
        return $result > 0;
    }
833739
public function insert($data = null): IResult
    {
        if(null === $data)
        {
            $data = static::parseSaveData($this);
        }
        else if(!$data instanceof \ArrayAccess)
        {
            $data = new LazyArrayObject($data);
        }
        $query = static::query($this);

        // 插入前
        $this->trigger(ModelEvents::BEFORE_INSERT, [
            'model' => $this,
            'data'  => $data,
            'query' => $query,
        ], $this, \Imi\Model\Event\Param\BeforeInsertEventParam::class);

        $result = $query->insert($data);
        if($result->isSuccess())
        {
            foreach(ModelManager::getFields($this) as $name => $column)
            {
                if($column->isAutoIncrement)
                {
                    $this[$name] = $result->getLastInsertId();
                    break;
                }
            }
        }

        // 插入后
        $this->trigger(ModelEvents::AFTER_INSERT, [
            'model' => $this,
            'data'  => $data,
            'result'=> $result
        ], $this, \Imi\Model\Event\Param\AfterInsertEventParam::class);

        // 子模型插入
        ModelRelationManager::insertModel($this);

        return $result;
    }
880913
public function add(array $data)
    {
        $result = null;
        $this->hook->attach('file.add.before', $data, $result, $this);

        if (isset($result)) {
            return (int) $result;
        }

        if (empty($data['mime_type'])) {
            $data['mime_type'] = mime_content_type(gplcart_file_absolute($data['path']));
        }

        if (empty($data['file_type'])) {
            $data['file_type'] = strtolower(strtok($data['mime_type'], '/'));
        }

        if (empty($data['title'])) {
            $data['title'] = basename($data['path']);
        }

        $data['created'] = $data['modified'] = GC_TIME;
        $result = $data['file_id'] = $this->db->insert('file', $data);

        $this->setTranslations($data, $this->translation_entity, 'file', false);

        $this->hook->attach('file.add.after', $data, $result, $this);
        return (int) $result;
    }
323982
public function getValue($name)
    {
        if (! is_string($name)) {
            return null;
        }

        $bits = explode('.', $name);
        $postData = $_POST;

        foreach ($bits as $key) {
            if (is_array($postData) && isset($postData[$key])) {
                $postData = $postData[$key];
            } else {
                return null;
            }
        }

        return $postData;
    }
399398
public function insert($data)
	{
		//var_dump($data);
		unset($this->_error);
		if(is_array($data))
		{
			$fields = '';
			$values = '';
			reset($data);
			for($counter = 0, $maxIndex = count($data), $valid = true; $counter < $maxIndex && $valid == true; $counter ++)
			{
				$elementKey = key($data);
				$elementKey = $this->_db->escape($elementKey);
				$valid = in_array($elementKey, $this->_fields);
				if($valid == true)
				{
                    $element = $data[$elementKey];
                    $element = $this->_db->escape($element);
					if(is_object($element) == true)
					{
						$valid = false;
						$this->_error = 'field: '.$elementKey.'is an object (this method just accept strings)';
					}
					else
					{
						if(is_numeric($element) == false)
							$values .= '\''.$element.'\'';
						else
							$values .= $element;
						$fields .= $elementKey;
						if(($counter + 1) < $maxIndex)
						{
							$fields .= ',';
							$values .= ',';
						}
						next($data);
					}
				}
				else
				{
					$this->_error = 'field: '.$elementKey.' is not defined in '.$this->_tableName;
				}
			}
			if($valid == true)
			{
				$this->_query = 'INSERT INTO '.$this->_tableName.'('.$fields.') VALUES('.$values.')';
				if($this->_db->execute($this->_query) !== false)
				{
					return $this->_db->insertId();
				}
				else
				{
					$this->_error = $this->_db->errorStr();
				}
			}
		}
		return false;
	}
824257
public function insert(array $data)
    {
        $this->normalizeDataColumns($data);

        $this->setSearchIndexableData($data);

        return $this->app['db']->insert($this->getTable(), $data);
    }
569039
private function convertData(array $data = null)
    {
        if (!is_array($data)) {
            return $data;
        }

        foreach ($data as $key => $val) {
            /** convert dbrefs */
            if (is_array($val) && isset($val['$ref']) && isset($val['$id'])) {
                $data[$key] = $this->convertData(
                    $this->resolveObject($val['$ref'], $val['$id'])
                );
            } elseif (is_array($val)) {
                $data[$key] = $this->convertData($val);
            }
            /** convert mongodate to text dates **/
            if ($val instanceof \MongoDate) {
                $data[$key] = $this->dateConverter->formatDateTime($val->toDateTime());
            }
            /** convert mongoid */
            if ($val instanceof \MongoId) {
                $data[$key] = (string) $val;
            }
        }

        return $data;
    }
97706
public function set(array $data)
    {
        $result = null;
        $this->hook->attach('rating.set.before', $data, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $conditions = array(
            'user_id' => $data['user_id'],
            'product_id' => $data['product_id']
        );

        $this->db->delete('rating_user', $conditions);

        $this->addByUser($data);

        $result = $this->setBayesian($data);
        $this->hook->attach('rating.set.after', $data, $result, $this);
        return $result;
    }
12753
public function getRawValue()
	{
		$name = $this->name;
		return !empty($_POST[$name]) ? $_POST[$name] : null;
	}
348755
protected function _value($data)
    {
        $field = $this->config('name');
        $value = $data[$field];
        if (empty($value) && $this->_defaultDefined()) {
            $value = $this->config('default');
        }

        return $value;
    }
421888
public function put($data)
    {
        if (empty($data) or !is_array($data))
        {
            return false;
        }
        if ($this->db->insert($data, $this->table))
        {
            $lastInsertId = $this->db->lastInsertId();
            if ($lastInsertId == 0)
            {
                return true;
            }
            else
            {
                return $lastInsertId;
            }
        }
        else
        {
            return false;
        }
    }
713488
public function insert(array $data): self
    {
        $this->reset();
        // simply check is not assoc to prepare multi-insert
        if (!isset($data[0])) {
            $data = [$data];
        }

        return $this->push('insert', $data);
    }