function NodeController::__construct
Same name in other branches
- 9 core/modules/node/src/Controller/NodeController.php \Drupal\node\Controller\NodeController::__construct()
- 10 core/modules/node/src/Controller/NodeController.php \Drupal\node\Controller\NodeController::__construct()
- 11.x core/modules/node/src/Controller/NodeController.php \Drupal\node\Controller\NodeController::__construct()
Constructs a NodeController object.
Parameters
\Drupal\Core\Datetime\DateFormatterInterface $date_formatter: The date formatter service.
\Drupal\Core\Render\RendererInterface $renderer: The renderer service.
\Drupal\Core\Entity\EntityRepositoryInterface $entity_repository: The entity repository.
File
-
core/
modules/ node/ src/ Controller/ NodeController.php, line 54
Class
- NodeController
- Returns responses for Node routes.
Namespace
Drupal\node\ControllerCode
public function __construct(DateFormatterInterface $date_formatter, RendererInterface $renderer, EntityRepositoryInterface $entity_repository = NULL) {
$this->dateFormatter = $date_formatter;
$this->renderer = $renderer;
if (!$entity_repository) {
@trigger_error('The entity.repository service must be passed to NodeController::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
$entity_repository = \Drupal::service('entity.repository');
}
$this->entityRepository = $entity_repository;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.