Mercurial > hg > isophonics-drupal-site
diff core/modules/comment/src/CommentLazyBuilders.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line diff
--- a/core/modules/comment/src/CommentLazyBuilders.php Thu Feb 28 13:21:36 2019 +0000 +++ b/core/modules/comment/src/CommentLazyBuilders.php Thu May 09 15:33:08 2019 +0100 @@ -3,9 +3,10 @@ namespace Drupal\comment; use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; +use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait; use Drupal\Core\Entity\EntityFormBuilderInterface; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Entity\EntityManagerInterface; +use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Render\RendererInterface; use Drupal\Core\Session\AccountInterface; @@ -15,13 +16,19 @@ * Defines a service for comment #lazy_builder callbacks. */ class CommentLazyBuilders { + use DeprecatedServicePropertyTrait; /** - * The entity manager service. + * {@inheritdoc} + */ + protected $deprecatedProperties = ['entityManager' => 'entity.manager']; + + /** + * The entity type manager service. * - * @var \Drupal\Core\Entity\EntityManagerInterface + * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ - protected $entityManager; + protected $entityTypeManager; /** * The entity form builder service. @@ -61,8 +68,8 @@ /** * Constructs a new CommentLazyBuilders object. * - * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager - * The entity manager service. + * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager + * The entity type manager service. * @param \Drupal\Core\Entity\EntityFormBuilderInterface $entity_form_builder * The entity form builder service. * @param \Drupal\Core\Session\AccountInterface $current_user @@ -74,8 +81,8 @@ * @param \Drupal\Core\Render\RendererInterface $renderer * The renderer service. */ - public function __construct(EntityManagerInterface $entity_manager, EntityFormBuilderInterface $entity_form_builder, AccountInterface $current_user, CommentManagerInterface $comment_manager, ModuleHandlerInterface $module_handler, RendererInterface $renderer) { - $this->entityManager = $entity_manager; + public function __construct(EntityTypeManagerInterface $entity_type_manager, EntityFormBuilderInterface $entity_form_builder, AccountInterface $current_user, CommentManagerInterface $comment_manager, ModuleHandlerInterface $module_handler, RendererInterface $renderer) { + $this->entityTypeManager = $entity_type_manager; $this->entityFormBuilder = $entity_form_builder; $this->currentUser = $current_user; $this->commentManager = $comment_manager; @@ -106,7 +113,7 @@ 'comment_type' => $comment_type_id, 'pid' => NULL, ]; - $comment = $this->entityManager->getStorage('comment')->create($values); + $comment = $this->entityTypeManager->getStorage('comment')->create($values); return $this->entityFormBuilder->getForm($comment); } @@ -134,7 +141,7 @@ if (!$is_in_preview) { /** @var \Drupal\comment\CommentInterface $entity */ - $entity = $this->entityManager->getStorage('comment')->load($comment_entity_id); + $entity = $this->entityTypeManager->getStorage('comment')->load($comment_entity_id); $commented_entity = $entity->getCommentedEntity(); $links['comment'] = $this->buildLinks($entity, $commented_entity); @@ -169,14 +176,14 @@ if ($entity->access('delete')) { $links['comment-delete'] = [ 'title' => t('Delete'), - 'url' => $entity->urlInfo('delete-form'), + 'url' => $entity->toUrl('delete-form'), ]; } if ($entity->access('update')) { $links['comment-edit'] = [ 'title' => t('Edit'), - 'url' => $entity->urlInfo('edit-form'), + 'url' => $entity->toUrl('edit-form'), ]; } if ($entity->access('create')) { @@ -205,7 +212,7 @@ if ($this->moduleHandler->moduleExists('content_translation') && $this->access($entity)->isAllowed()) { $links['comment-translations'] = [ 'title' => t('Translate'), - 'url' => $entity->urlInfo('drupal:content-translation-overview'), + 'url' => $entity->toUrl('drupal:content-translation-overview'), ]; }