lib/controllers/ObjectController.php
public function actionSetPrimary()
    {
        $p = $this->_parseParams();
        $this->_checkParams($p, ['type', 'object', 'relation']);
        $this->params = &$p;

        if (!$p['object']->can('update')) {
            throw new HttpException(403, "You do not have access to update the {$p['type']->title->getPlural(true)} '{$p['object']->descriptor}'");
        }

        Yii::$app->response->view = false;
        Yii::$app->response->task = 'status';

        if (!$p['relation']->setPrimary($p['relationshipRole'])) {
            Yii::$app->response->error = 'Unable to set relationship as primary!';
        } else {
            Yii::$app->response->task = 'status';
            Yii::$app->response->success = '<em>' . $p['object']->descriptor . '</em> was set as primary!';

            $primaryModelClass = get_class($p['object']);
            Yii::$app->response->trigger = [
                ['refresh', '.model-' . $primaryModelClass::baseClassName()],
            ];
        }
    }
public function actionSetPrimary()
    {
        $p = $this->_parseParams();
        $this->_checkParams($p, ['type', 'object', 'relation']);
        $this->params = &$p;

        if (!$p['object']->can('update')) {
            throw new HttpException(403, "You do not have access to update the {$p['type']->title->getPlural(true)} '{$p['object']->descriptor}'");
        }

        Yii::$app->response->view = false;
        Yii::$app->response->task = 'status';

        if (!$p['relation']->setPrimary($p['relationshipRole'])) {
            Yii::$app->response->error = 'Unable to set relationship as primary!';
        } else {
            Yii::$app->response->task = 'status';
            Yii::$app->response->success = '<em>' . $p['object']->descriptor . '</em> was set as primary!';

            $primaryModelClass = get_class($p['object']);
            Yii::$app->response->trigger = [
                ['refresh', '.model-' . $primaryModelClass::baseClassName()],
            ];
        }
    }
public function actionSetPrimary ( ) { $ p = $ this -> _parseParams ( ) ; $ this -> _checkParams ( $ p , [ 'type' , 'object' , 'relation' ] ) ; $ this -> params = & $ p ; if ( ! $ p [ 'object' ] -> can ( 'update' ) ) { throw new HttpException ( 403 , "You do not have access to update the {$p['type']->title->getPlural(true)} '{$p['object']->descriptor}'" ) ; } Yii :: $ app -> response -> view = false ; Yii :: $ app -> response -> task = 'status' ; if ( ! $ p [ 'relation' ] -> setPrimary ( $ p [ 'relationshipRole' ] ) ) { Yii :: $ app -> response -> error = 'Unable to set relationship as primary!' ; } else { Yii :: $ app -> response -> task = 'status' ; Yii :: $ app -> response -> success = '<em>' . $ p [ 'object' ] -> descriptor . '</em> was set as primary!' ; $ primaryModelClass = get_class ( $ p [ 'object' ] ) ; Yii :: $ app -> response -> trigger = [ [ 'refresh' , '.model-' . $ primaryModelClass :: baseClassName ( ) ] , ] ; } }
[[@doctodo method_description:actionSetPrimary]].

@throws HttpException [[@doctodo exception_description:HttpException]]
[[ @doctodo method_description : actionSetPrimary ]] .