// get the current context instance $context = sfContext::getInstance(); // get the user object $user = $context->getUser(); // retrieve session data $sessionData = $user->getAttribute('mySessionData');
// get the current context instance $context = sfContext::getInstance(); // retrieve a configuration parameter $paramValue = $context->getConfiguration()->get('myConfigParameter');
// get the current context instance $context = sfContext::getInstance(); // retrieve the request object $request = $context->getRequest(); // access request parameters $paramValue = $request->getParameter('myParam');In this example, sfContext getInstance is used to access the current request object. The getRequest method returns the sfWebRequest object, which contains information about the current HTTP request. Once we have the request object, we can access request parameters using the getParameter method. Package library: Symfony framework