Im trying to pass a single instance of a helper object to the view by
making use of "template.filter_parameters" event. However it seems
that for every partial the object gets instantiated again, is there a
way around this?


This is the code that I have in my Pluginconfiguration, Am I just
being stupid.

public function setup()
{
  // ...

  $this->dispatcher->connect('template.filter_parameters', array(
    $this, 'templateFilterParameters'
  ));
}

public function templateFilterParameters(sfEvent $event, $parameters)
{
  $parameters['my_helper_object'] = MyHelperObject::getInstance();

  return $parameters;
}


and the MyHelperObject::getInstance() method looks like:

public static function createInstance()
    {
        if(!isset ( self::$instance ))
        {
            $c = __CLASS__;
            self::$instance = new $c;
        }
        return self::$instance;
    }

Any advice would be apreciated :)

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