I am almost complete symfony2 newbie, I tried to find simple solution for my problem with no luck.
Imagine a database entity - Person for example. This Person should have it's photogallery, simple blog, settings, etc.. Each of these sections should be located in their separate controller classes (PhotogalleryController, BlogController, etc..).
What (or where) is the best practice to read the Person entity from database? I don't want to do it in every action in every controller but all the actions with routes /[person_string_id]/**** need the Person entity.
I have read something about event listeners, I believe this could be solution for me, but I could use some advice here.
I am almost complete symfony2 newbie, I tried to find simple solution for my problem with no luck.
Imagine a database entity - Person for example. This Person should have it's photogallery, simple blog, settings, etc.. Each of these sections should be located in their separate controller classes (PhotogalleryController, BlogController, etc..).
What (or where) is the best practice to read the Person entity from database? I don't want to do it in every action in every controller but all the actions with routes /[person_string_id]/**** need the Person entity.
I have read something about event listeners, I believe this could be solution for me, but I could use some advice here.
If you don't want (and you shouldn't) rewrite this for every action just create a method in the controller class, or even better, define a base controller class and define all the methods there.
Il giorno mercoledì 20 giugno 2012 20:56:02 UTC+2, Adam Chysky ha scritto:
> I am almost complete symfony2 newbie, I tried to find simple solution > for my problem with no luck.
> Imagine a database entity - Person for example. This Person should have > it's photogallery, simple blog, settings, etc.. Each of these sections > should be located in their separate controller classes > (PhotogalleryController, BlogController, etc..).
> What (or where) is the best practice to read the Person entity from > database? I don't want to do it in every action in every controller but > all the actions with routes /[person_string_id]/**** need the Person > entity.
> I have read something about event listeners, I believe this could be > solution for me, but I could use some advice here.