protected function _actionAdd(AnCommandContext $context)
    {
        $data = $context->data;
        $value = AnRequest::get('session.invite_token', 'string', null);

        if (empty($data->value) || $value != $data->value) {
            throw new LibBaseControllerExceptionBadRequest('Invalid token signature');
            return;
        }

        AnRequest::set('session.invite_token', null);

        $token = $this->getRepository()->getEntity(array(
                        'data' => array(
                            'value' => $value,
                            'inviter' => get_viewer(),
                            'serviceName' => 'facebook',
                        ),
                    ));

        if (!$token->save()) {
            throw new LibBaseControllerExceptionInternal();
            return;
        }
    }
protected function _actionAdd(AnCommandContext $context)
    {
        $data = $context->data;
        $value = AnRequest::get('session.invite_token', 'string', null);

        if (empty($data->value) || $value != $data->value) {
            throw new LibBaseControllerExceptionBadRequest('Invalid token signature');
            return;
        }

        AnRequest::set('session.invite_token', null);

        $token = $this->getRepository()->getEntity(array(
                        'data' => array(
                            'value' => $value,
                            'inviter' => get_viewer(),
                            'serviceName' => 'facebook',
                        ),
                    ));

        if (!$token->save()) {
            throw new LibBaseControllerExceptionInternal();
            return;
        }
    }
protected function _actionAdd ( AnCommandContext $ context ) { $ data = $ context -> data ; $ value = AnRequest :: get ( 'session.invite_token' , 'string' , null ) ; if ( empty ( $ data -> value ) || $ value != $ data -> value ) { throw new LibBaseControllerExceptionBadRequest ( 'Invalid token signature' ) ; return ; } AnRequest :: set ( 'session.invite_token' , null ) ; $ token = $ this -> getRepository ( ) -> getEntity ( array ( 'data' => array ( 'value' => $ value , 'inviter' => get_viewer ( ) , 'serviceName' => 'facebook' , ) , ) ) ; if ( ! $ token -> save ( ) ) { throw new LibBaseControllerExceptionInternal ( ) ; return ; } }
Store a token for a service.

@param AnCommandContext $context
Store a token for a service .