Hi, 2010/10/27 pghoratiu <[email protected]>: > Two possible solutions: > > 1. create a class or helper in lib/ that caches the data extraction so > that the second time when you request the data > you have it, something like this: > class myUserProfileCache > { > static protected $userData = null; > > public static function getUserData() > { > if (is_null(self::$userData)) > { > // request data and store it localy for caching purposes > } > > return self::$userData; > } > }
I think that this solution is exactly what I was looking for. Huge thanks! Kind regards, Michal > > 2. Store the variable in the request and not in the user session > http://www.symfony-project.org/api/1_4/sfRequest#method_setparameter > > gabriel > > On Oct 27, 2:36 pm, Michał Piotrowski <[email protected]> wrote: >> Hi, >> >> I've got a layout: >> >> [some html] >> [some php] >> <?php include_component('foo', 'foo1') ?> >> <?php include_component('foo', 'foo2') ?> >> [some html] >> <?php include_component('foo', 'foo3') ?> >> [some random code] >> >> The problem is that all components needs some user data. I've got an >> user settings table and I need to SELECT the same user data in each >> component. >> >> As a result of such br00ken design sometimes I need to SELECT the same >> data three, four times (sometimes in action). >> >> I tried to write an init component that fetches all data and stores it >> in as session variables, but this works only for authenticated users. >> >> Is there a way to store variable in component that would be visible >> for other components and for action? >> >> Best regards, >> Michal > > -- > If you want to report a vulnerability issue on symfony, please send it to > security at symfony-project.com > > You received this message because you are subscribed to the Google > Groups "symfony users" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en > -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
