__construct() public method

Sets a number of properties based on conventions if they are empty. To override the conventions CakePHP uses you can define properties in your class declaration.
public __construct ( Cake\Network\Request $request = null, Response $response = null, string | null $name = null, Cake\Event\EventManager | null $eventManager = null, Cake\Controller\ComponentRegistry | null $components = null )
$request Cake\Network\Request Request object for this controller. Can be null for testing, but expect that features that use the request parameters will not work.
$response Cake\Network\Response Response object for this controller.
$name string | null Override the name useful in testing when using mocks.
$eventManager Cake\Event\EventManager | null The event manager. Defaults to a new instance.
$components Cake\Controller\ComponentRegistry | null The component registry. Defaults to a new instance.
 public function __construct($request = null, $response = null)
 {
     $request->webroot = '/';
     Router::setRequestInfo($request);
     parent::__construct($request, $response);
 }
Exemplo n.º 2
2
 /**
  * Make it possible to dynamically define the components array during tests
  *
  * @param CakeRequest $request
  * @param CakeResponse $response
  * @return void
  */
 public function __construct($request = null, $response = null)
 {
     $this->components = self::$componentsArray;
     return parent::__construct($request, $response);
 }
Exemplo n.º 3
1
 public function __construct(\Cake\Network\Request $request = null, \Cake\Network\Response $response = null, $name = null, $eventManager = null, $components = null)
 {
     parent::__construct($request, $response, $name, $eventManager, $components);
     $this->set('bt_consultar_acao', true);
     $this->set('bt_cadastrar_acao', true);
     $this->set('bt_excluir_acao', true);
 }
 /**
  * construct method
  */
 public function __construct($request = null, $response = null)
 {
     $request->addParams(Router::parse('/auth_test'));
     $request->here = '/auth_test';
     $request->webroot = '/';
     Router::setRequestInfo($request);
     parent::__construct($request, $response);
 }
Exemplo n.º 5
1
 /**
  * Constructor.
  *
  * @param \Cake\Network\Request $request Request object for this controller.
  *  Can be null for testing, but expect that features that use the request
  *  parameters will not work.
  * @param \Cake\Network\Response $response Response object for this controller.
  */
 public function __construct($request = null, $response = null)
 {
     parent::__construct($request, $response);
     $location = $this->response->location();
     $this->viewBuilder()->className('CMS\\View\\View');
     if (empty($location)) {
         $this->viewMode('default');
         $this->prepareTheme();
         $this->checkMaintenanceMode();
     }
     $this->response->header('Content-Language', language('code'));
     $this->response->header('X-Generator', sprintf('QuickAppsCMS %s (http://quickappscms.org)', quickapps('version')));
 }
Exemplo n.º 6
1
 /**
  * Constructor
  *
  * @param \Cake\Network\Request $request Request instance.
  * @param \Cake\Network\Response $response Reponse instance.
  */
 public function __construct($request = null, $response = null)
 {
     parent::__construct($request, $response);
     if (count(Router::extensions()) && !isset($this->RequestHandler)) {
         $this->loadComponent('RequestHandler');
     }
     $eventManager = $this->eventManager();
     if (isset($this->Auth)) {
         $eventManager->detach($this->Auth);
     }
     if (isset($this->Security)) {
         $eventManager->detach($this->Security);
     }
     $this->cacheAction = false;
     $this->viewPath = 'Error';
 }
Exemplo n.º 7
1
 /**
  * Call the parent (original) constructor.
  *
  * @param Request|null $request
  * @param Response|null $response
  * @param null $name
  * @param null $eventManager
  * @param null $components
  */
 public function construct(Request $request = null, Response $response = null, $name = null, $eventManager = null, $components = null)
 {
     parent::__construct($request, $response, $name, $eventManager, $components);
 }
Exemplo n.º 8
0
 /**
  * Constructor
  *
  * @param \Cake\Network\Request|null $request Request instance.
  * @param \Cake\Network\Response|null $response Response instance.
  */
 public function __construct($request = null, $response = null)
 {
     parent::__construct($request, $response);
     if (count(Router::extensions()) && !isset($this->RequestHandler)) {
         $this->loadComponent('RequestHandler');
     }
     $eventManager = $this->eventManager();
     if (isset($this->Auth)) {
         $eventManager->off($this->Auth);
     }
     if (isset($this->Security)) {
         $eventManager->off($this->Security);
     }
 }
 public function __construct($request, $response = null)
 {
     parent::__construct($request, $response);
     $this->viewClass = '\\App\\View\\PhpView';
 }
Exemplo n.º 10
-1
 /**
  * Construct running after initialize
  * @param Request|null $request
  * @param Response|null $response
  * @param null $name
  * @param null $eventManager
  */
 public function __construct(Request $request = null, Response $response = null, $name = null, $eventManager = null)
 {
     parent::__construct($request, $response, $name, $eventManager);
     Hook::applyHookMethods('Hook.controller_methods', $this);
     /** This below event trigger After "SpiderController.afterInitialize" event.*/
     $this->eventManager()->dispatch(new Event('SpiderController.afterConstruct', $this));
 }