/** * 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(); }
public function getServerResponseFor($nativeVars) { $response = new Response(); $response->setResult($nativeVars); $json = $response->toJson(); $response = $this->makeHttpResponseFrom($json); return $response; }