function CommentController::__construct
Same name in other branches
- 9 core/modules/comment/src/Controller/CommentController.php \Drupal\comment\Controller\CommentController::__construct()
- 10 core/modules/comment/src/Controller/CommentController.php \Drupal\comment\Controller\CommentController::__construct()
- 11.x core/modules/comment/src/Controller/CommentController.php \Drupal\comment\Controller\CommentController::__construct()
Constructs a CommentController object.
Parameters
\Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel: HTTP kernel to handle requests.
\Drupal\comment\CommentManagerInterface $comment_manager: The comment manager service.
\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager service.
\Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager: The entity field manager service.
\Drupal\Core\Entity\EntityRepositoryInterface $entity_repository: The entity repository service.
File
-
core/
modules/ comment/ src/ Controller/ CommentController.php, line 73
Class
- CommentController
- Controller for the comment entity.
Namespace
Drupal\comment\ControllerCode
public function __construct(HttpKernelInterface $http_kernel, CommentManagerInterface $comment_manager, EntityTypeManagerInterface $entity_type_manager, EntityFieldManagerInterface $entity_field_manager = NULL, EntityRepositoryInterface $entity_repository = NULL) {
$this->httpKernel = $http_kernel;
$this->commentManager = $comment_manager;
$this->entityTypeManager = $entity_type_manager;
if (!$entity_field_manager) {
@trigger_error('The entity_field.manager service must be passed to CommentController::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
$entity_field_manager = \Drupal::service('entity_field.manager');
}
$this->entityFieldManager = $entity_field_manager;
if (!$entity_repository) {
@trigger_error('The entity.repository service must be passed to CommentController::__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.