Example #1
0
 /**
  * Emit JSON
  *
  * Send appropriate HTTP headers. If no Id, then return an empty string.
  *
  * @return string
  */
 public function toJson()
 {
     $this->sendHeaders();
     if (!$this->isError() && null === $this->getId()) {
         return '';
     }
     return parent::toJson();
 }
Example #2
0
 public function getServerResponseFor($nativeVars)
 {
     $response = new Response();
     $response->setResult($nativeVars);
     $json = $response->toJson();
     $response = $this->makeHttpResponseFrom($json);
     return $response;
 }