Hi,
$this->campaigns = $this->getCampaigns();

I suppose "$this" is an sfActions, so

1/do this in your preExecute if for only one sfActions class :
protected function getCampaigns(){ return
CampaignTable::getCampaigns($this->getUser()->...->Organization); }

or
 write this code in your own action class extending sfActions class and make
it extended by the other sfActions which do need that method.


Cheers,


Before Printing, Think about Your Environmental Responsibility!
Avant d'Imprimer, Pensez à Votre Responsabilitée Environnementale!


On Thu, Feb 18, 2010 at 10:16 PM, Samuel Morhaim
<[email protected]>wrote:

> I use the following line in many places, and I want to make it
> shorter.. since I will never be pulling the information for ALL
> organizations..
>
> $this->campaigns =
>
> Doctrine::getTable('Campaign')->getCampaigns($this->getUser()->getGuardUser()->Organization);
>
>
> I created the method getCampaigns
>
>
> class CampaignTable extends Doctrine_Table
> {
>        public function getCampaigns(Organization $organization = null)
>        {
>                $q = Doctrine_Query::create()
>          ->from('Campaign c')
>          ->where('c.organization_id =?', $organization->id);
>
>        return $q->execute();
>        }
>
>
>
> Should I have done this differently?  If not, then how could I just do
>
> $this-campaigns = Doctrine:getCampaigns();    // Get all campaigns for
> logged in user...  ?
>
>
> Thank you.
>
> --
> 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]<symfony-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
>
>

-- 
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.

Reply via email to