I prefer throwing a new `NotFoundException` and then using an exception strategy to transform it into whatever kind of output you want :)
Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On 15 September 2013 21:29, whisher <[email protected]> wrote: > samsonasik wrote > > hm.., maybe like this ? > > > > $this->getResponse()->setStatusCode(404); > > $this->getResponse()->setContent(json_encode(array( > > 'status' => $this->getResponse()->getStatusCode(), > > 'error' =>'Not Found', > > 'message' => 'Page not found.' > > ))); > > $this->getResponse()->getHeaders() > > ->addHeaderLine('content-type', 'application/json'); > > > > return $this->getResponse(); > > hm... not very clean (I'd like use JsonModel) but if I don't found any > other > way ^^ > > > > -- > View this message in context: > http://zend-framework-community.634137.n4.nabble.com/AbstractRestfulController-not-found-resource-best-way-tp4660975p4660980.html > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- > List: [email protected] > Info: http://framework.zend.com/archives > Unsubscribe: [email protected] > > >
