lib/controllers/ObjectController.php
public function actionWatch()
    {
        if (empty($_GET['id']) or !($object = $this->params['object'] = Registry::getObject($_GET['id'], false)) or !($typeItem = $this->params['typeItem'] = $object->objectTypeItem)) {
            throw new HttpException(404, "Unknown object.");
        }
        if (!$object->can('read')) {
            throw new HttpException(403, "Unable to access object.");
        }
        Yii::$app->request->object = $object;

        $watching = empty($_GET['stop']);
        if ($object->watch($watching)) {
            Yii::$app->response->task = 'trigger';
            if ($watching) {
                Yii::$app->response->success = 'You are now watching ' . $object->descriptor . '.';
                Yii::$app->response->trigger = [
                    ['startedWatching'],
                ];
            } else {
                Yii::$app->response->success = 'You stopped watching ' . $object->descriptor . '.';
                Yii::$app->response->trigger = [
                    ['stoppedWatching'],
                ];
            }
        } else {
            Yii::$app->response->error = 'Unable update the watching status of this object.';
        }
    }
public function actionWatch()
    {
        if (empty($_GET['id']) or !($object = $this->params['object'] = Registry::getObject($_GET['id'], false)) or !($typeItem = $this->params['typeItem'] = $object->objectTypeItem)) {
            throw new HttpException(404, "Unknown object.");
        }
        if (!$object->can('read')) {
            throw new HttpException(403, "Unable to access object.");
        }
        Yii::$app->request->object = $object;

        $watching = empty($_GET['stop']);
        if ($object->watch($watching)) {
            Yii::$app->response->task = 'trigger';
            if ($watching) {
                Yii::$app->response->success = 'You are now watching ' . $object->descriptor . '.';
                Yii::$app->response->trigger = [
                    ['startedWatching'],
                ];
            } else {
                Yii::$app->response->success = 'You stopped watching ' . $object->descriptor . '.';
                Yii::$app->response->trigger = [
                    ['stoppedWatching'],
                ];
            }
        } else {
            Yii::$app->response->error = 'Unable update the watching status of this object.';
        }
    }
public function actionWatch ( ) { if ( empty ( $ _GET [ 'id' ] ) or ! ( $ object = $ this -> params [ 'object' ] = Registry :: getObject ( $ _GET [ 'id' ] , false ) ) or ! ( $ typeItem = $ this -> params [ 'typeItem' ] = $ object -> objectTypeItem ) ) { throw new HttpException ( 404 , "Unknown object." ) ; } if ( ! $ object -> can ( 'read' ) ) { throw new HttpException ( 403 , "Unable to access object." ) ; } Yii :: $ app -> request -> object = $ object ; $ watching = empty ( $ _GET [ 'stop' ] ) ; if ( $ object -> watch ( $ watching ) ) { Yii :: $ app -> response -> task = 'trigger' ; if ( $ watching ) { Yii :: $ app -> response -> success = 'You are now watching ' . $ object -> descriptor . '.' ; Yii :: $ app -> response -> trigger = [ [ 'startedWatching' ] , ] ; } else { Yii :: $ app -> response -> success = 'You stopped watching ' . $ object -> descriptor . '.' ; Yii :: $ app -> response -> trigger = [ [ 'stoppedWatching' ] , ] ; } } else { Yii :: $ app -> response -> error = 'Unable update the watching status of this object.' ; } }
[[@doctodo method_description:actionWatch]].

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