Displays a single Assignment model.

@param int $id

@return mixed
4502
public function actionView(int $id)
    {
        $model = $this->findModel($id);

        return $this->render('view', [
            'model' => $model,
            'usernameField' => $this->usernameField,
        ]);
    }
538117
public function actionView($id)
    {
        $model = $this->findModel($id);
        $providerTerm = new \yii\data\ArrayDataProvider([
            'allModels' => $model->terms,
        ]);

        return $this->render('view', [
            'model'        => $this->findModel($id),
            'providerTerm' => $providerTerm,
        ]);
    }
758238
public function actionAssignments($id) {
    Url::remember('', 'actions-redirect');
    $user = $this->findModel($id);
    $user->scenario = User::SCENARIO_UPDATE_ROLES;

    $event = $this->getUserEvent($user);

    $this->performAjaxValidation($user);

    $this->trigger(self::EVENT_BEFORE_ROLES_UPDATE, $event);
    if ($user->load(Yii::$app->request->post()) && $user->save()) {
      Yii::$app->getSession()->setFlash('success', Yii::t('users', 'Account roles have been updated'));
      $this->trigger(self::EVENT_BEFORE_ROLES_UPDATE, $event);
      return $this->refresh();
    }

    return $this->render('_assignments', [
      'user' => $user,
    ]);
  }
1269705
public function get($id)
	{
		$this->getResponse()
			->setStatusCode(Response::STATUS_CODE_200);
		
		$classifiedService = $this->getServiceLocator()->get('document.service.classified');
		
		try {
			$data = $classifiedService->get($id);
		} catch(\Exception $e) {
			$this->getResponse()
				->setStatusCode(Response::STATUS_CODE_500);
			$data = new \StdClass();
		}
		
		return new JsonModel(array(
			'data' => $data
		));
	}
1244788
public function actionView($id)
    {
        $model = $this->findModel($id);

        return $this->render('view', ['model' => $model, 'items' => $this->getItems($id)]);
    }
1325397
public function fetchById($id)
    {
        $data = $this->getProvider()->fetchById($id);
        return $this->resultAsModel($data);
    }
331665
protected function findModel($id)
    {
        if (($model = Term::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException(t('app', 'The requested page does not exist.'));
        }
    }
1364247
public function show($id)
    {
        // Check the cache for item data. Otherwise get from the db.
        $item = Cache::rememberForever($this->modelTableName . ':' . $id, function () use ($id) {
            return call_user_func([$this->getModelClass(), 'findOrFail'], $id)->toArray();
        });

        return $this->generateResponse($this->modelTableName, $item);
    }
310123
public function get($id = null){
        if(!is_null($id)){
            return $this->find($id);
        }
        return $this->model->get();
    }
303286
protected function get($id = null)
    {
        $this->filter();

        if ($this->eagerLoad) {
            $this->model = $this->model->with($this->eagerLoad);
        }

        if ($id) {
            return $this->model->where('id', $id)->firstOrFail();
        }

        return $this->model->get();
    }
1092131
public static function One($id) {
    $class = get_called_class();
    
    if (! isset(self::$refs[$class][$id])) {
      $file = self::File($id);
      $obj = unserialize(file_get_contents($file));
      self::$refs[$class][$id] = $obj;
    }
    
    return self::$refs[$class][$id];
  }
59128
public function getTranslationModel($id = null)
    {
        $translationModel = new TranslationModel();
        $translationModel->setKeyword($this->getKeyword());
        $translationModel->setDomain($this->getDomain());
        $translationModel->addText($this->getLocale(), $this->getText(), $id);

        return $translationModel;
    }
846821
public function &get($id)
    {
        if (isset($this->instances[$id])) {
            return $this->instances[$id];
        }

        $result = $this->resolve($id);

        if (array_key_exists($id, $this->instances)) {
            $this->instances[$id] = & $result;
        }

        return $result;
    }
751176
public function getOrFail($id)
    {
        if ($model = $this->get($id)) {
            return $model;
        }

        throw (new NotFoundException("No results for id $id"))->setModel(get_class($this->model));
    }
1280205
public function getById($id)
    {
        $record = NavigationRecord::findOne(['id' => $id]);

        if ($record) {
            return new NavigationModel($record->getAttributes());
        }

        return null;
    }
71950
public function actionView($id)
    {
        $model = $this->findModel($id);
        $authManager = Yii::$app->getAuthManager();
        $avaliable = $assigned = [
            'Roles' => [],
            'Permission' => [],
            'Routes' => [],
        ];
        $children = array_keys($authManager->getChildren($id));
        $children[] = $id;
        foreach ($authManager->getRoles() as $name => $role) {
            if (in_array($name, $children)) {
                continue;
            }
            $avaliable['Roles'][$name] = $name;
        }
        foreach ($authManager->getPermissions() as $name => $role) {
            if (in_array($name, $children)) {
                continue;
            }
            $avaliable[$name[0] === '/' ? 'Routes' : 'Permission'][$name] = $name;
        }

        foreach ($authManager->getChildren($id) as $name => $child) {
            if ($child->type == Item::TYPE_ROLE) {
                $assigned['Roles'][$name] = $name;
            } else {
                $assigned[$name[0] === '/' ? 'Routes' : 'Permission'][$name] = $name;
            }
        }
        $avaliable = array_filter($avaliable);
        $assigned = array_filter($assigned);
        return $this->render('view', ['model' => $model, 'avaliable' => $avaliable, 'assigned' => $assigned]);
    }
772210
public function getById($id)
    {
        $model = $this
            ->prepareQuery()
            ->where($this->model->getTable() . '.id', $id)
            ->first();

        if (empty($model))
            return null;

        $model = $this->addPermissionsForModel($model);

        return $this->formatModel($model);
    }