eZ Community » Forums » eZ Publish 5 Platform » Good practices with external content...
expandshrink

Good practices with external content rooting

Good practices with external content rooting

Monday 20 October 2014 10:07:47 am - 1 reply

Hello,

I created a node in my eZPublish Backend. This node have a public URL :
http://www.website.com/Exemple/SubExemple

I created a MatchRoute to use a specific Controller and specific template for this page.
In this page i list a lot of objects with a pager. These objects are managed by Doctrine in a custom table. For each object i have a "More" button to see the full page of the object. On this button i want to use a route that has a format http://www.website.com/Exemple/SubExemple/Title-Of-My-External-Object.html

This is my code : 

I want to know if it's a good way to do. 

Thanks

Thursday 23 October 2014 12:46:28 pm

Couple of this I can see from the code:

"loadLocation()" & "loadContentByContentInfo()"

You'll want some try catches around that. See the method descriptions for the expected exceptions. I do recommend adding a generic "catch all" as well as the NotFound/Unautharized.

"Id\Location: [906]"

Matching by ID can become difficult if you have multiple environments (dev, uat, prod), and the databases are not exactly in sync. Could you use a class identifier here, like "frontpage", or a custom one?

Your "routing.yml" is not doing anything and can be removed. Or perhaps you forgot to include your showAction() method?

Other than that the code looks like it should work...

*edit. The code styling in these forums sucks.

Modified on Thursday 23 October 2014 12:50:33 pm by Gareth Arnott

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from