/** * 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(); }