getStorage() public method

Retrieve the storage.
public getStorage ( ) : sfStorage
return sfStorage The current sfStorage implementation instance.
コード例 #1
0
 /**
  * Initialize this User.
  *
  * @param sfContext $context  A Context instance.
  * @param array  $parameters An associative array of initialization parameters.
  *
  * @return bool true, if initialization completes successfully, otherwise
  *              false.
  *
  * @throws <b>sfInitializationException</b> If an error occurs while initializing this User.
  */
 public function initialize($context, $parameters = array())
 {
     $this->context = $context;
     $this->parameterHolder = new sfParameterHolder();
     $this->parameterHolder->add($parameters);
     $this->attributeHolder = new sfParameterHolder(self::ATTRIBUTE_NAMESPACE);
     // read attributes from storage
     $attributes = $context->getStorage()->read(self::ATTRIBUTE_NAMESPACE);
     if (is_array($attributes)) {
         foreach ($attributes as $namespace => $values) {
             $this->attributeHolder->add($values, $namespace);
         }
     }
     // set the user culture to sf_culture parameter if present in the request
     // otherwise
     //  - use the culture defined in the user session
     //  - use the default culture set in i18n.yml
     if (!($culture = $context->getRequest()->getParameter('sf_culture'))) {
         if (null === ($culture = $context->getStorage()->read(self::CULTURE_NAMESPACE))) {
             $culture = sfConfig::get('sf_i18n_default_culture', 'en');
         }
     }
     $this->setCulture($culture);
 }