This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » eZ Publish 5 Platform » Best way to handle controller stuff...
expandshrink

Best way to handle controller stuff combined with the ViewController

Best way to handle controller stuff combined with the ViewController

Sunday 10 February 2013 5:01:42 pm - 7 replies

Hello,

What is the recommended way to handle "business logic stuff" that are usually in a controller when we us the ViewController from an urlalias. 

In this way we usually have only access to the template ... 

Do you advise to use the PreContentViewListener and add all business logic code with conditions depending on the content type for example or do you advise to use sub requests ? 

Thanks !

Sunday 10 February 2013 9:12:37 pm

Not sure I "get" your need at 100%, but subcontrollers would be the way to go

Sunday 10 February 2013 9:46:33 pm

An example of my need would be that when rendering the view full of the frontpage I need to fetch an RSS feed and for each item in feed I need to get database related stuff. 

I don't want to do this kind of stuff in the template and I don't have acces to the ViewController.

But sub controller seems fine, thanks !

Monday 11 February 2013 9:57:45 am

Yep, I would indeed go with a sub-controller.

Monday 11 February 2013 11:58:48 am

Hi Matthieu,

This is more or less the same issue as in Carlos' post.

For lazy people, here's the response in the other post:

For now, the sub-request is clearly the way to go. However, I personally feel that in some use cases that's a bit weird and I already wrote about this in the post about the Planet eZ Publish.fr. That's why, I created an enhancement request for an alternative way of doing this. Feel free to comment the JIRA issue, if you like the idea or if you have any remark.

Cheers

Modified on Monday 11 February 2013 11:59:07 am by Damien Pobel

Monday 11 February 2013 12:48:49 pm

Thank you Damien, and it's interesting to read that using many sub-controller has an impact on performance.

Monday 11 February 2013 2:36:43 pm

About impact on performance : Yes, if you use ESIs. The more ESI there are, the more the reverse proxy will have to work to do the patchwork of your page. Although it will be negligible with Varnish, it will have a more important impact using Symfony reverse proxy. It really depends on how you use your cache response headers... Prefer using (S)Max-Age.

Tuesday 12 February 2013 11:34:50 am

One note about the issue created by Damien about this topic. If you like it, you can:

  • watch it to get notified about it;
  • vote for it !
  • add your opinion about it, even if you don't like it. Actually, if you don't like it, please do comment ! happy.gif Emoticon

The more feedback we have on Jira, the better the feature will be.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from