Prado\Web\THttpSession::init PHP Метод

init() публичный Метод

This method is required by IModule. If AutoStart is true, the session will be started.
public init ( $config )
    public function init($config)
    {
        if ($this->_autoStart) {
            $this->open();
        }
        $this->_initialized = true;
        $this->getApplication()->setSession($this);
        register_shutdown_function(array($this, "close"));
    }

Usage Example

Пример #1
0
 /**
  * Initializes the module.
  * This method is required by IModule.
  * It reads the CacheModule property.
  * @param TXmlElement module configuration
  */
 public function init($config)
 {
     if ($this->_cacheModuleID === '') {
         throw new TConfigurationException('cachesession_cachemoduleid_required');
     } else {
         if (($cache = $this->getApplication()->getModule($this->_cacheModuleID)) === null) {
             throw new TConfigurationException('cachesession_cachemodule_inexistent', $this->_cacheModuleID);
         } else {
             if ($cache instanceof ICache) {
                 $this->_cache = $cache;
             } else {
                 throw new TConfigurationException('cachesession_cachemodule_invalid', $this->_cacheModuleID);
             }
         }
     }
     $this->setUseCustomStorage(true);
     parent::init($config);
 }