机器审核
@param int $id model id
@param string $suggestion the ID to be looked for
@return void
974219
public static function review($id, $suggestion)
    {
        if (($model = static::findOne($id)) != null) {
            if ($suggestion == 'pass') {
                $model->setPublished();
            } elseif ($suggestion == 'block') {
                $model->setRejected('');
            } elseif ($suggestion == 'review') { //人工审核，不做处理
                return;
            }
        }
    }
1372042
public function handleEdit(int $id)
    {
        if ($this->presenter->isAjax())
        {
            $this->categoryId = $id;
            $this->onOpen();
        }
    }
433320
public function fetchById ($id)
    {
        $record = $this->query->fetchById($id);

        if ($record instanceof \stdClass) {
            $this->setRecord($record);
        } else {
            $this->record = null;
        }
    }
798497
public function suggest($suggester, $options = [])
    {
        if (empty($suggester)) {
            $suggester = '{}';
        }
        if (is_array($suggester)) {
            $suggester = Json::encode($suggester);
        }
        $url = [
            $this->index !== null ? $this->index : '_all',
            '_suggest'
        ];

        return $this->db->post($url, array_merge($this->options, $options), $suggester);
    }
929520
public function setId($id)
    {
        if (is_null($this->id) && ! is_null($id) && ($model = $this->getRepository()->find($id))) {
            $this->id = $id;

            parent::setModel($model);
            $this->getButtons()->setModel($model);
            $this->setModelClass(get_class($model));
        }
    }
1229497
public function actionEdit(int $id): void
	{
		$this->content = $this->orm->content->getById($id);
		if (!$this->content) {
			$this->error();
		}
	}
1339082
protected function _edit($id) {
		try {
			$result = $this->{$this->modelClass}->edit($id, $this->request->data);
		} catch (OutOfBoundsException $e) {
			return $this->alert($e, array('redirect' => $this->referer(array('action' => 'list'), true)));
		}

		$this->request->data = $this->{$this->modelClass}->data;

		if (!empty($this->request->data[$this->{$this->modelClass}->alias][$this->{$this->modelClass}->displayField])) {
			$this->_appendToCrumb($this->request->data[$this->{$this->modelClass}->alias][$this->{$this->modelClass}->displayField]);
		}

		if (false === $result) {
			$this->alert('save.fail');
		} else if ($this->request->is('put')) {
			$this->alert('save.success');
		}
	}
629646
public function populate($id)
    {
        if (empty($id)) {
            throw new Exception('No identifier supplied for totp', Totp\Exception::NO_IDENTIFIER_SUPPLIED);
        }

        $this->sendApiCall(self::ACTION_RETRIEVE, $this->getCreateUrl() . '/' . urlencode($id));
    }
577942
public function actionTasknoteupdate($id)
    {
        $model = Task::getTaskNoteModel($id);

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            return $this->redirect(['tasknoteview', 'id' => $model->id]);
        } else {
            return $this->render('tasknoteupdate', [
                'model' => $model,
            ]);
        }
    }
31985
public function id($id, $like = false)
    {
        /* @var $this ActiveQuery */
        $model = $this->noInitModel;
        return $this->likeCondition($id, $model->idAttribute, $like);
    }
1274014
public function actionView($id)
    {
        try{

            $request = \Yii::$app->request;
            if ($request->getIsOptions()) {
                return $this->ResponseOptions($this->verbs()['view']);
            }
            $model = $this->findModel($id);
            if($model!=null){
                $result= ['success'=>true,'rules'=>$model];
            } else {
                $result= ['success'=>false,'message'=>'没有对应规则'];
            }

            return $result;
        }catch(Exception $e){
            throw new Exception($e);
        }
        //return $this->render('view', ['model' => $model]);
    }
1056382
public function view($id = null)
    {
        $cmsTermRelation = $this->CmsTermRelation->get($id, [
            'contain' => ['CmsTermTaxonomy', 'CmsContent']
        ]);
        $this->set('cmsTermRelation', $cmsTermRelation);
        $this->set('_serialize', ['cmsTermRelation']);
    }
178630
public function actionDelete($id)
    {
        $subCount = Menu::find()->where('`pid`=:id',[':id'=>$id])->count();
        if($subCount == 0) { //不包含子菜单时 方可删除
            $this->findModel($id)->delete();
        }
        return $this->redirect(['index']);
    }
182589
public function set_id( $id ) {
		$this->id = $this->is_valid_id( $id ) ? $id : $this->generate_session_id();
	}
1141859
public static JinxConstants.SuggestionStatus suggestionStatusIdToSuggestionStatusEnum(Integer id) {
        if (id == null) {
            return null;
        }
        JinxConstants.SuggestionStatus status;
        switch (id) {
            case 0:
                status = JinxConstants.SuggestionStatus.pending;
                break;
            case 1:
                status = JinxConstants.SuggestionStatus.approved;
                break;
            case 2:
                status = JinxConstants.SuggestionStatus.rejected;
                break;
            default:
                status = null;
                break;
        }
        return status;
    }
898393
public function toggleSuggestionApproved($ID) {

		if($suggestion = ExtensibleSearchSuggestion::get()->byID($ID)) {

			// Update the search suggestion.

			$approved = !$suggestion->Approved;
			$suggestion->Approved = $approved;
			$suggestion->write();

			// Determine the approval status.

			$status = $approved ? 'Approved' : 'Disapproved';
			return "{$status} \"{$suggestion->Term}\"!";
		}
		else {
			return null;
		}
	}
892252
public function update($id, $key, $value=null)
     {
         $model =  $this->model->find($id);

         if (is_array($key))
             $model->update($key);
         else
             $model->{$key}= $value;

         $model->save();
     }