Hi
create a listener that execute on every request, put the data in the
session, and check if the data exist in the session, if yes then dont do a
query to database, else load data from database.
I think in session is better, if u want to get theme in Twig:
app.session.get('param_name')
regards
Le jeudi 13 septembre 2012 02:44:03 UTC, Tetranz a écrit :
> What's the best and most efficient way to get some data from one entity
> and display it on every page? I'm using twig and doctrine.
> I have an entity and database table which is only ever going to have one
> instance. It has things like company name etc. It's essentially
> configuration stuff so I know a config file is more efficient but I want it
> to be editable by an admin user.
> I guess I'm asking two questions. Where do I put the code to retrieve the
> entity on every request and how do I get the data into my top level twig
> template?
> Thanks