Cake\Controller\Component\AuthComponent::initialize PHP Method

initialize() public method

Initialize properties.
public initialize ( array $config ) : void
$config array The config data.
return 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

Beispiel #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