Cake\Controller\Component\AuthComponent::initialize PHP Метод

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

Initialize properties.
public initialize ( array $config ) : void
$config array The config data.
Результат void
    public function initialize(array $config)
    {
        $controller = $this->_registry->getController();
        $this->eventManager($controller->eventManager());
        $this->response =& $controller->response;
        $this->session = $controller->request->session();
    }

Usage Example

Пример #1
0
 /**
  * Constructor hook method
  * @param array $config The configuration settings provided to this
  *  component
  * @return void
  * @see http://api.cakephp.org/3.3/class-Cake.Controller.Component.html#_initialize
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     //The authorization error is shown only if the user is already logged
     //  in and he is trying to do something not allowed
     if (!$this->user('id')) {
         $this->config('authError', false);
     }
 }
All Usage Examples Of Cake\Controller\Component\AuthComponent::initialize