Loading helpers from an action or model in Symfony 1.2
Just quick post today about loading helpers in symfony 1.2 from an action or model.
Previously I would use the sfLoader class to load a helper, but it now says:
The sfLoader::loadHelpers() method is deprecated. Please use the same method from sfApplicationConfiguration.
So, from the action you should now use:
$this->getContext()->getConfiguration()->loadHelpers('Url');
From the model you can use:
sfContext::getInstance()->getConfiguration()->loadHelpers('Url');




Be carefull,
sfContext is not instancied in tasks, so it might not be avaible in your Model.
Hello,
You should use sfProjectConfiguration::getActive()->loadHelpers(array(‘Url’)); instead of sfContext, which won’t be instancied in some cases (tests, tasks).
Noel
thanks guys, never thought of that.