Tuesday, August 14, 2012

Re: Why doesn't JsonView trigger callbacks?

[Tumbleweed] 

:P

On Monday, August 13, 2012 11:28:53 AM UTC-5, Lucho Molina wrote:
I was playing around with JsonView and the PaginatorHelper and noticed that the data returned by $this->Paginator->next() was different to the one returned by the same method when using the normal (HTML) view. 

Digging into the code, I found out that the JsonView doesn't trigger the beforeRender callback. Why is that? is this a bug or is it meant to be like that by design?

Specifically speaking, the render method of the View class triggers the callbacks like this:

464 $this->getEventManager()->dispatch(new CakeEvent('View.beforeRender', $this, array($viewFileName)));
465 $this->Blocks->set('content', $this->_render($viewFileName));
466 $this->getEventManager()->dispatch(new CakeEvent('View.afterRender', $this, array($viewFileName)));

Whereas JsonView->render() will just return the $content without triggering the callbacks. 

I'm on version 2.1.3, btw.

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate