保存昵称

@return boolean
12629
public function save()
    {
        if ($this->validate() && (bool)$this->getUser()->updateAttributes(['nickname' => $this->nickname])) {
            return $this->getUser();
        }
        return false;
    }
1051928
public function persist()
    {

        $blob = $this->serializer->serialize($this->_attributes, $this->serializeOptions);

        $result = (bool)$this->filesystem->write($this->url, $blob, $this->getOption('file_locking'));

        if (!$hashMethod = $this->getOption('checksum_method')) {
            return $result;
        }

        $checksum = $this->createChecksum($hashMethod, $blob);

        $savedBlob = $this->filesystem->read($this->url);

        $this->checkData($hashMethod, $savedBlob, $checksum);

        return $result;
    }
1118382
public function save()
    {
        $data = $this->getData();
        if ($this->_collection->save($data, ["j" => true])['err'] === null) {
            $this->_id = $data['_id'];
            $this->_cache->store(static::getCollection()."_{$this->_id}", $data);
            return true;
        }
        // @codeCoverageIgnoreStart
        return false;
        // @codeCoverageIgnoreEnd
    }
28787
public function save()
    {
        $operations = [];

        $this->items->each(function ($item) use(&$operations) {
          $operation = $this->setOperator();
          $operation->setOperand($item);
          $operation->setOperator('SET');

          $operations[] = $operation;
        });

        if(empty($operations))
            return false;

        return $this->adWordsServices->mutate($operations)->getValue();
    }
1284374
public function saveToDB(){
		//Validate...
		if(empty($this->alias)){
			return false;
			}
		//Save to db...
		if(empty($this->id)){
			return $this->db_insert();
			}
		return $this->db_update();
		}
1318630
public function save()
    {
        $result;
        if (! self::$id) {
            // new record so we insert
            $query = "INSERT INTO $this->tableName (".implode(", ", array_keys($this->props)).") VALUES(";

            for ($i = 0; $i < count($this->props); $i++) {
                $query .= "?";

                if ($i != count($this->props) - 1) {
                    $query .= ",";
                }
            }

            $query .= ");";

            $insert = Connection::db()->prepare($query);
            $result = $insert->execute(array_values($this->props));
        } else {
            // existing record, se we update
            $query = "UPDATE $this->tableName SET ";

            $count = 0;
            foreach ($this->props as $key => $value) {
                $query .= "$key = '$value'";

                if ($count != count($this->props) - 1) {
                    $query .= ",";
                }
                $count++;
            }

            $query .= " WHERE id = ".self::$id;
            $result = Connection::db()->query($query);
        }

        if (! $result) {
            return false;
        } else {
            return true;
        }
    }
302422
public function save()
    {
        // No payload to save.
        if (! $this->hasPayLoad()) {
            return false;
        }

        // Save the token.
        return (bool) file_put_contents($this->getFilePath(), collect($this->payLoad)->toJson(), LOCK_EX);
    }
814023
public function save()
    {
        $result = false;

        if ($this->isConnected())
        {
            if (!$this->isNew()) {
                $result = $this->getTable()->update($this);
            } else {
                $result = $this->getTable()->insert($this);
            }

            //Reset the modified array
            if ($result !== false)
            {
                if (((integer) $result) > 0) {
                    $this->_modified = array();
                }
            }
        }

        return (bool) $result;
    }
859814
public function save()
    {
        if ($this->validate()) {

            $authManager = Yii::$app->authManager;

            $item = $authManager->getRole($this->name);
            if ($item) {
                $update = true;
            } else {
                $item = $authManager->createRole($this->name);
                $update = false;
            }

            $item->description = $this->description;
            $item->ruleName = $this->rule_name;
            $item->data = $this->data;

            if ($update) {
                if (!$authManager->update($this->name, $item)) {
                    return false;
                }
            } else {
                if (!$authManager->add($item)) {
                    return false;
                }
            }

            $this->isNewRecord = false;

            $authManager->removeChildren($item);
            if ($this->_childRoles !== null) {
                foreach ($this->_childRoles as $childName) {
                    $child = $authManager->getRole($childName);
                    $authManager->addChild($item, $child);
                }
            }
            if ($this->_childPermissions !== null) {
                foreach ($this->_childPermissions as $childName) {
                    $child = $authManager->getPermission($childName);
                    $authManager->addChild($item, $child);
                }
            }

        } else {
            return false;
        }

        return true;
    }
722904
public function save()
    {

        $ok = $this->getDataConnector()->saveResourceLink($this);
        if ($ok) {
            $this->settingsChanged = false;
        }

        return $ok;

    }
40511
public function save()
	{
		if ( ! $this->is_loaded() ) return false;

		$this->fill_defaults();

		$error = null;

		$id = wp_insert_post( $this->attributes, $error );

		if ( ! empty( $id ) ) {

			$this->attributes['ID'] = $id;

			$this->save_meta_all();

		}

		return $error === false ? true : $error;
	}
364123
public function save(): Record
    {
        //没有主键字段,则不进行保存
        if (!$this->_primaryKey) {
            return $this;
        }

        //获取要写入的数据
        $data = self::dataForWrite();

        //本表的主键字段
        $pk = $this->_primaryKey;

        //如果没有主键字段,插入数据
        if (!isset($data[$pk])) {
            $id = $this->_table->insert($data);
            $this->_data[$pk] = $id;
            $this->{$pk} = $id;
            return $this;
        }

        //以下是修改,主键的值
        $pkValue = $data[$pk];

        //与原始数据对比,挑出有变化的部分
        $data = array_diff_assoc($data, $this->_old);

        //如果有变化,只修改有变化的部分
        if (!empty($data)) {
            $this->_table->update($data, [$pk => $pkValue]);
        }

        //检查关联字段,逐个保存
        self::saveRelation();

        return $this;
    }
625347
public function save(): void
    {
        $keys = [];

        $primaryKey = $this->primaryKey;

        //每个行对象进行保存
        foreach ($this as $record) {
            /*
             * @var SRecord
             */
            $record->save();

            //取行对象的主键值
            $keys[] = $record->{$primaryKey};
        }

        //要删除的记录的主键值
        $deletedKeys = array_diff($this->oldPrimaryKeys, $keys);

        //一对多时,在关联表中进行删除
        if ($this->type === 'hasMany') {
            /**
             * @var $tableClass Table
             */
            $tableClass = $this->tableClass;
            $tableClass::instance()->delete([$this->primaryKey => $deletedKeys]);
        } elseif ($this->type === 'belongsToMany') {
            //多对多关联时,删除 中间表
            $config = $this->relation;

            //配置信息
            $middleClass = $config['middle'];  //中间表
            $selfForeignKey = $config['selfForeignKey'];//中间表中与本表关联的键
            $targetForeignKey = $config['targetForeignKey'];//中间表中与对方 表关联的键
            $selfPrimaryValue = $config['selfPrimaryValue']; //主表主键值

            //在中间表中进行删除
            $middleClass::instance()->delete([$selfForeignKey => $selfPrimaryValue, $targetForeignKey => $deletedKeys]);
        }
    }
392247
public function saveLocal()
    {
        $file = file_get_contents($this->fileField);
        $this->oriName = basename($this->fileField);
        $this->fileSize = strlen($file);
        $this->fileType = $this->getExtension();
        $this->fullName = $this->getFullName();
        $this->filePath = $this->getFilePath();
        $this->fileName = $this->getFileName();
        $dirName = dirname($this->filePath);

        if (!is_dir($dirName)) {//递归创建保存目录
            FileHelper::createDirectory($dirName, $this->dirMode, true);
        }
        //检查文件大小是否超出限制
        if (!$this->checkSize()) {
            $this->stateInfo = Yii::t('attachment', 'The file size exceeds the site limit.');
            return false;
        }

        //移动文件
        if (!(file_put_contents($this->filePath, $file) && file_exists($this->filePath))) { //移动失败
            $this->stateInfo = Yii::t('attachment', 'An error occurred while saving the file.');
            return false;
        } else { //移动成功
            @unlink($this->fileField);
            $this->saveModel();
            $this->stateInfo = 'SUCCESS';
            return true;
        }
    }
584596
public function save() {
        if (!$this->isPersistent()) {
            $this->dao()->transaction(function() {
                if ($this->beforeSave() !== true)               // pre-processing hook
                    return $this;
                $this->insert();
                $this->afterSave();                             // post-processing hook
            });
        }
        elseif ($this->isModified()) {
            $this->dao()->transaction(function() {
                if ($this->beforeSave() !== true)               // pre-processing hook
                    return $this;
                $this->update();
                $this->afterSave();                             // post-processing hook
            });
        }
        else {
            // persistent but not modified
        }
        return $this;
    }
719958
public function save()
    {
        if ($this->isNew()) {
            return $this->adapter->create($this);
        } else {
            return $this->adapter->update($this);
        }
    }
494090
public function save()
    {
        if ($this->validate()) {
            $manager = Configs::authManager();
            if ($this->_item === null) {
                if ($this->type == Item::TYPE_ROLE) {
                    $this->_item = $manager->createRole($this->name);
                } else {
                    $this->_item = $manager->createPermission($this->name);
                }
                $isNew = true;
            } else {
                $isNew = false;
                $oldName = $this->_item->name;
            }
            $this->_item->name = $this->name;
            $this->_item->description = $this->description;
            $this->_item->ruleName = $this->ruleName;
            $this->_item->data = $this->data === null || $this->data === '' ? null : Json::decode($this->data);
            if ($isNew) {
                $manager->add($this->_item);
            } else {
                $manager->update($oldName, $this->_item);
            }
            Helper::invalidate();
            return true;
        } else {
            return false;
        }
    }