Hey,
If I understand you correctly, you want to have the id like "3"
available in every part of your script?

Try setting it as a config value: sfConfig::set('campaign_id',
$campaign->getId()); if I recall correctly. This is available
everywhere. Else I recommend either bridging to Zend Framework for a
registry, or build on yourself.

On Feb 9, 11:52 am, Olivier Revollat <revol...@gmail.com> wrote:
> Hello !
> On my application (e-commerce) I list the available products. For each
> products I call a filter that modify the product price according to current
> price campaign (if any campaign is active)
> So for each products, I retrive the current campagne (SQL QUERY) :
>
> $query = sprintf("SELECT %s AS campagneid FROM %s WHERE NOW() BETWEEN %s AND
> %s LIMIT 1", AmaCampagnePeer::ID, AmaCampagnePeer::TABLE_NAME,
> AmaCampagnePeer::DEBUT_VALIDITE, AmaCampagnePeer::FIN_VALIDITE);
> $statement = $connection->prepare($query);
> $statement->execute();
> $campagneid = $statement->fetch(PDO::FETCH_OBJ);
>
> But as soon as I get the current's campagn ID this is not going to change
> during the current HTTP request ... so I don't have to execute this request
> for each products... I want to use the same campagne ID for all the HTTP
> request and not recalculate it each time I filter a product (to retrive the
> campagne price) ... some kind of singleton design pattern .. but I don't
> know exactly how to implement this (for example how do I know that I am I
> the same HTTP request ?)
> I don't know if i'm clear enougth ... :)
>
> Thanks for your help, ideas, suggestions !!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to