自动关联数据更新（针对一对一关联）
@access public
@return void
969679
protected function autoRelationUpdate()
    {
        foreach ($this->relationWrite as $name => $val) {
            if ($val instanceof Model) {
                $val->save();
            } else {
                $model = $this->getRelation($name);
                if ($model instanceof Model) {
                    $model->save($val);
                }
            }
        }
    }
460251
public function actionUpdate()
	{
		$post=$this->loadPost();
		if(Yii::app()->request->isPostRequest)
		{
			if(isset($_POST['Post']))
				$post->setAttributes($_POST['Post']);
			if($post->save())
				$this->redirect(array('show','id'=>$post->id));
		}
		$this->render('update',array('post'=>$post));
	}
210944
public function RefreshDataFromDatabase()
    {
        $this->ClearInternalCache();
        $sActiveLanguageId = self::getLanguageService()->getActiveLanguageId();
        if (null !== $sActiveLanguageId) {
            $this->SetLanguage($sActiveLanguageId);
        }
        $bEnableObjectCaching = $this->GetEnableObjectCaching();
        $this->SetEnableObjectCaching(false);
        $this->Load($this->id);
        $this->SetEnableObjectCaching($bEnableObjectCaching);
    }
182204
protected function __update()
	{
		/** Rebase array indices */
		parent::__update();

		if ( $this->count() && $this->attribute instanceof DOMAttr ) {
			$this->attribute->value = (string) $this;
		}
	}
861645
public function update($now)
    {
        if ($now >= ($this->lastCallTime + $this->interval)) {
            $this->lastCallTime = $now;
            $this->callNow();
        }
    }
557605
public function up()
    {
        Schema::create('product__products', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('id');
            // product type
            $table->string('type');
            // product category
            $table->integer('category_id')->unsigned();
            // product info
            $table->string('sku')->nullable();
            // product price
            $table->integer('price')->unsigned();
            $table->integer('sale_price')->unsigned();
            $table->integer('min_order_limit');
            $table->integer('max_order_limit');
            // stock management
            $table->tinyInteger('use_stock');
            // tax
            $table->tinyInteger('use_tax');
            // etc
            $table->tinyInteger('use_review')->unsigned();
            // shipping
            $table->string('shipping_method_id')->nullable();
            $table->integer('shipping_storage_id')->unsigned();
            // status
            $table->enum('status',['active','hide','inactive'])->default('active');

            $table->timestamps();
        });

        Schema::create('product__product_translations', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('id');

            $table->string('name');
            $table->text('content')->nullable();
            $table->text('description')->nullable();

            $table->integer('product_id')->unsigned();
            $table->string('locale')->index();
            $table->unique(['product_id', 'locale']);
            $table->foreign('product_id')->references('id')->on('product__products')->onDelete('cascade');
        });

    }
455547
public function insert()
    {
        self::$instance->reset();
        $this->sql('INSERT INTO ' . $this->oosql_table);

        $arg_list = func_get_args();
        $numargs = func_num_args();

        if ($numargs > 0) {
            $this->oosql_numargs = $numargs;
            $this->sql(' (');

            $this->sql(implode(',', $arg_list));

            $this->sql(')');
        }
        $this->oosql_insert = true;
        return $this;
    }
1333837
public function up()
    {

        /*
         * Table: comments
         */
        Schema::create(config('litecms.news.comment.model.table'), function ($table) {
            $table->increments('id');
            $table->longText('comment')->nullable();
            $table->string('author', 255)->nullable();
            $table->string('email', 255)->nullable();
            $table->integer('mobile')->nullable();
            $table->string('slug', 255)->nullable();
            $table->enum('published', ['yes','no'])->nullable();
            $table->integer('user_id')->nullable();
            $table->string('user_type', 255)->nullable();
            $table->integer('news_id')->nullable();
            $table->softDeletes();
            $table->nullableTimestamps();
        });
    }
287697
public function update() {
        $this->isNewRecord = false;
        if ($this->usesTimestamps()) {
            $this->updateTimestamps();
        }
        $this->invoke(self::BEFORE_UPDATE, [$this]);
        if (!$this->validate()) {
            return false;
        }
        $query = $this->getPrimaryKeyQuery();
        if (empty($query)) {
            $this->setError('pk', 'ERROR PK!');
            return false;
        }
        $data = $this->_getRealFields();
        if (empty($data)) {
            return true;
        }
        $row = $query
            ->update($data);
        if (!empty($row)) {
            $this->setOldAttribute();
        } else {
            $this->setError('data', 'Data is not change!');
        }
        $this->invoke(self::AFTER_UPDATE, [$this]);
        return $row;
    }
1254080
public function refresh()
    {
        if ($this->_id !== null) {
            $data = $this->_collection->findOne(['_id' => $this->_id]);
            foreach ($this->_schema as $name => $desc) {
                if (isset($data[$name])) {
                    $this->$name = $data[$name];
                }
            }
        }
    }
1349253
public function refresh(): void
    {
        $this->size = null;
        $this->lastModified = null;
        $this->isReadable = null;
        $this->isWritable = null;
        $this->exists = null;
        $this->created = null;
        $this->isSymLink = null;
        $this->isDir = null;
        $this->isFile = null;
        $this->isExecutable = null;
        $this->ownerId = null;
        $this->owner = null;
        $this->group = null;
        $this->groupId = null;
        $this->lastRead = null;
    }
355196
public function save()
    {
        $redis = static::__getRedis($this);
        if(null === $this->__ttl)
        {
            $redis->set($this->__getKey(), $this->toArray());
        }
        else
        {
            $redis->set($this->__getKey(), $this->toArray(), $this->__ttl);
        }
    }
246908
public function update()
    {
        $attributes = request()->validate([
            'firstname' => 'required',
            'lastname'  => 'required',
            'email'     => 'required|email|' . Rule::unique('users')->ignore(user()->id),
            'password'  => 'nullable|min:4|confirmed',
            'cellphone' => 'nullable',
        ]);

        // update user
        user()->update([
            'firstname' => $attributes['firstname'],
            'lastname'  => $attributes['lastname'],
            'email'     => $attributes['email'],
            'cellphone' => $attributes['cellphone'],
        ]);

        // only update when a new password was entered
        $message = '';
        if ($attributes['password'] && strlen($attributes['password']) >= 2) {
            $message = " and <strong>Password</strong> ";
            user()->update([
                'password' => bcrypt($attributes['password']),
            ]);
        }

        alert()->success('Updated!',
            "Your personal information {$message} was successfully updated.");

        return redirect()->back();
    }
101560
public function refresh()
    {
        /* @var $cache CacheInterface */
        $cache = is_string($this->db->schemaCache) ? Zilf::$app->get($this->db->schemaCache, false) : $this->db->schemaCache;
        if ($this->db->enableSchemaCache && $cache instanceof CacheInterface) {
            TagDependency::invalidate($cache, $this->getCacheTag());
        }
        $this->_tableNames = [];
        $this->_tableMetadata = [];
    }
648692
public function update_by()
    {
        $args = func_get_args();
        $data = array_pop($args);

        $data = $this->trigger('before_update', $data);

        if ($this->validate($data) !== FALSE)
        {
            $this->_set_where($args);
            $result = $this->_database->set($data)
                               ->update($this->_table);
            $this->trigger('after_update', array($data, $result));

            return $result;
        }
        else
        {
            return FALSE;
        }
    }
645207
public function save()
    {
        if ($this->_isSaved) {
            $this->update($this->id);
        } else {
            $this->id = $this->insert();
            $this->_isSaved = true;
        }
    }
1018687
protected function update()
    {
        DbTable::update($this->db, $this->_tableName, $this->_cols, $this->id);
    }