src/wcmf/application/controller/RESTController.php
protected function handleSubResponse(Response $subResponse, $oidStr=null) {
    $response = $this->getResponse();
    if (!$subResponse->hasErrors()) {
      $response->clearValues();
      $response->setHeaders($subResponse->getHeaders());
      $response->setStatus($subResponse->getStatus());
      if ($subResponse->hasValue('object')) {
        $object = $subResponse->getValue('object');
        if ($object != null) {
          $response->setValue($object->getOID()->__toString(), $object);
        }
      }
      if ($subResponse->hasValue('list')) {
        $objects = $subResponse->getValue('list');
        $response->setValues($objects);
      }
      if ($oidStr != null && $subResponse->hasValue($oidStr)) {
        $object = $subResponse->getValue($oidStr);
        $response->setValue($oidStr, $object);
        if ($subResponse->getStatus() == 201) {
          $this->setLocationHeaderFromOid($oidStr);
        }
      }
      return true;
    }

    // in case of error, return default response
    $response->setErrors($subResponse->getErrors());
    $response->setStatus(400);
    return false;
  }
protected function handleSubResponse(Response $subResponse, $oidStr=null) {
    $response = $this->getResponse();
    if (!$subResponse->hasErrors()) {
      $response->clearValues();
      $response->setHeaders($subResponse->getHeaders());
      $response->setStatus($subResponse->getStatus());
      if ($subResponse->hasValue('object')) {
        $object = $subResponse->getValue('object');
        if ($object != null) {
          $response->setValue($object->getOID()->__toString(), $object);
        }
      }
      if ($subResponse->hasValue('list')) {
        $objects = $subResponse->getValue('list');
        $response->setValues($objects);
      }
      if ($oidStr != null && $subResponse->hasValue($oidStr)) {
        $object = $subResponse->getValue($oidStr);
        $response->setValue($oidStr, $object);
        if ($subResponse->getStatus() == 201) {
          $this->setLocationHeaderFromOid($oidStr);
        }
      }
      return true;
    }

    // in case of error, return default response
    $response->setErrors($subResponse->getErrors());
    $response->setStatus(400);
    return false;
  }
protected function handleSubResponse ( Response $ subResponse , $ oidStr = null ) { $ response = $ this -> getResponse ( ) ; if ( ! $ subResponse -> hasErrors ( ) ) { $ response -> clearValues ( ) ; $ response -> setHeaders ( $ subResponse -> getHeaders ( ) ) ; $ response -> setStatus ( $ subResponse -> getStatus ( ) ) ; if ( $ subResponse -> hasValue ( 'object' ) ) { $ object = $ subResponse -> getValue ( 'object' ) ; if ( $ object != null ) { $ response -> setValue ( $ object -> getOID ( ) -> __toString ( ) , $ object ) ; } } if ( $ subResponse -> hasValue ( 'list' ) ) { $ objects = $ subResponse -> getValue ( 'list' ) ; $ response -> setValues ( $ objects ) ; } if ( $ oidStr != null && $ subResponse -> hasValue ( $ oidStr ) ) { $ object = $ subResponse -> getValue ( $ oidStr ) ; $ response -> setValue ( $ oidStr , $ object ) ; if ( $ subResponse -> getStatus ( ) == 201 ) { $ this -> setLocationHeaderFromOid ( $ oidStr ) ; } } return true ; } // in case of error, return default response $ response -> setErrors ( $ subResponse -> getErrors ( ) ) ; $ response -> setStatus ( 400 ) ; return false ; }
Create the actual response from the response resulting from delegating to
another controller
@param $subResponse The response returned from the other controller
@param $oidStr Serialized object id of the object to return (optional)
@return Boolean whether an error occured or not
Create the actual response from the response resulting from delegating to another controller