Insert inserts data to the repository. If single IRow is returned, it attempts to log audit information.

@param $data
@return bool|int|IRow
160963
public function insert($data)
    {
        $row = $this->getTable()->insert($data);
        if (!$row instanceof IRow) {
            return $row;
        }

        if ($this->auditLogRepository) {
            $to = $this->filterValues($this->excludeColumns((array)$data));

            $data = [
                'version' => '1',
                'from' => [],
                'to' => $to,
            ];
            $this->pushAuditLog(AuditLogRepository::OPERATION_CREATE, $row->getSignature(), $data);
        }

        return $row;
    }
601998
public function insert(array $data) {
        try {
            $pkData = parent::insert($data);
        } catch (Zend_Db_Statement_Exception $e) {
            if (strpos($e->getMessage(), 'Duplicate entry') === false ||
                strpos($e->getMessage(), 'checksum_unique') === false) {
                throw $e;
            }
            // @todo Return original primary key?
            // This would require a second round-trip to the database...
            return null;
        }
        return $pkData;
    }
264442
public function createOne($data)
    {
        $row = $this->getTable()::create();

        $data = $this->filterData($data);

        $row->setFromArray($data);
        return $row->save();
    }
433240
private function insertData($data)
    {
        $inserted = Yii::$app->db->createCommand()->batchInsert(
            $this->getName(),
            $this->cleanUpBatchInsertFields($this->getFields()),
            $this->cleanUpMatchRow($data)
        )->execute();

        return $inserted;
    }
963215
public function insertOrUpdate($data) {
        $map = $this->extractMap($data);
        $sql = "INSERT INTO $this->KVS_TABLE ($this->KVS_FK_NAME, $this->KVS_SK_NAME,
            uk1, sk1, tk1, co1, co2, json_body, created_at)
            VALUES (:foreign_key, :uk1, :sk1, :tk1, :co1, :co2, :json_body, $this->NOW)
            ON DUPLICATE KEY UPDATE
            $this->KVS_FK_NAME=:foreign_key, $this->KVS_SK_NAME=:secondary_key,
            sk1=:sk1, tk1=:tk1,
            co1=:co1, co2=:co2, json_body=:json_body, updated_at=$this->NOW ";
        $map[':foreign_key'] = $this->KVS_FK;
        $map[':secondary_key'] = $this->KVS_SK;
        $map[':json_body'] = json_encode($data);
        $stmt = $this->PDOX->queryDie($sql, $map);

        if ( $stmt->success) return($this->PDOX->lastInsertId());
        return false;
    }
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;
        }
    }
9723
public static function insert($table, $data) {
        $insert = Insert::table($table);
        foreach ($data as $field => $value) {
            $insert->set($field, $value);
        }
        return $insert->excuse();
    }
1144418
public function create( $data )
	{
		$record = $this->fill( $data );

		if( is_array($record) )
		{
			$this->collection()->insert($record);
		}

		return $record;
	}
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)");
    }
293823
public function add($data = [])
	{
		if (isset($data['email']) && isset($data['username']) && isset($data['password'])) {
			// todo asserts
			$create = array(
				'email' => $data['email'],
				'username' => Strings::webalize($data['username']),
				'password' => Passwords::hash($data['password']),
			);

		} else {
			throw new \InvalidArgumentException('We need username, email and password');
		}

		if (isset($data['role'])) {
			$create['role'] = $data['role'];
		} else {
			$create['role'] = 'user';
		}

		if (isset($data['name'])) {
			$create['name'] = $data['name'];
		}

		/** @var \Nette\Http\FileUpload $data ->avatar */
		if ($this->useFiles && $data['avatar'] && $data['avatar']->isOk()) {
			$create['avatar'] = $this->saveImage($data['avatar']);
		}

		$person = $this->repository->insert($create);

		return $person;
	}
1204338
public function insert(array $data = [], $replace = false, $getLastInsID = false, $sequence = null)
    {
        $this->parseOptions();

        $this->options['data'] = array_merge($this->options['data'], $data);

        return $this->connection->insert($this, $replace, $getLastInsID, $sequence);
    }
1211230
public function insert(array $data): int
    {
        $this->builder->setInsertData($data);
        $sql = $this->builder->buildSql();
        $this->builder = new QueryBuilder($this->pdo);
        return $this->execSql($sql);
    }
165411
public function persist(DataAbstract $data)
    {
        if ($data->exists()) {
            return $this->update($data);
        } else {
            return $this->insert($data);
        }
    }
54135
public function insert($data, $weight = 0)
    {
        if ($this->isEmpty()) {
            $this->_nodes[] = ['data' => $data, 'weight' => $weight];
            return $this;
        }

        $inserted = false;
        $new = [];
        while(count($this->_nodes) > 0) {
            $element = array_shift($this->_nodes);
            if (
                !$inserted &&
                $this->compare((int) $weight, $element['weight']) <= 0
            ) {
                $new[] = ['data' => $data, 'weight' => (int) $weight];
                $new[] = ['data' => $element['data'], 'weight' => $element['weight']];
                $inserted = true;
            } else {
                $new[] = ['data' => $element['data'], 'weight' => $element['weight']];
            }
        }
        if (!$inserted) {
            $new[] = ['data' => $data, 'weight' => $weight];
        }
        $this->_nodes = $new;
        return $this;
    }
1202213
public function insert(array $data) {
		$data = $this->filterFields($data, $this->_allowed_insert_fields);
		$data['created_at'] = Factory::load('\datetime')->format('Y-m-d H:i:s');

		return $this->_db->insertSafe($this->_table, $data);
	}
951395
public static function insert($table, $data = null) {
        if ($data !== null) {
            return Insert::insert($table, $data);
        } else {
            return Insert::table($table);
        }
    }
150797
protected function insert(Data $data)
    {
        $this->__before('insert', $data);
        $data->validate();

        if (!is_array($id = $this->doInsert($data))) {
            return false;
        }

        $this->pack($id, $data);
        $this->__after('insert', $data);

        return true;
    }