Re: [fw-general] Re: AbstractRestfulController not found resource best way

2013-09-15 Thread Marco Pivetta
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  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: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


[fw-general] Re: AbstractRestfulController not found resource best way

2013-09-15 Thread whisher
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: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com