public function getmailAction() { try { $jsonData = $this->getRequest()->getContent(); $data = $this->serializer->deserialize($jsonData, "Application\\API\\Canonicals\\Dto\\ThirdPartyEmailTransport", "json"); $emailRepo = $this->getServiceLocator()->get('EMailSvc'); $emails = $emailRepo->fetchMail($data->mailapikey); $context = new SerializationContext(); $context->setSerializeNull(true); $content = $this->serializer->serialize($emails, 'json', $context); $this->response->setContent($content); return $this->response; } catch (\Exception $ex) { error_log($ex->getMessage()); } exit; }
private function getJson($data) { $context = new SerializationContext(); $context->setSerializeNull(true); return $this->serializer->serialize($data, 'json', $context); }