Comments

Munavijayalakshmi created an issue. See original summary.

Munavijayalakshmi’s picture

Assigned: Munavijayalakshmi » Unassigned
Status: Active » Needs review
StatusFileSize
new1.84 KB
dhansen’s picture

Status: Needs review » Needs work

@Munavijayalakshmi Looks like you mistakenly posted your patch for 2870586 here.

nkoporec’s picture

Status: Needs work » Needs review
StatusFileSize
new5.55 KB

Created a patch for this issue.Please reviewed it.

icurk’s picture

Status: Needs review » Reviewed & tested by the community

Deprecated service was correctly replaced. I also noticed that dependency injection is almost never used. But for this a new issue should be created.

berdir’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/src/Plugin/Block/PollRecentBlock.php
    @@ -35,7 +35,7 @@ class PollRecentBlock extends BlockBase {
        */
       public function build() {
    -    $polls = \Drupal::entityManager()->getStorage('poll')->getMostRecentPoll();
    +    $polls = \Drupal::entityTypeManager()->getStorage('poll')->getMostRecentPoll();
         if ($polls) {
    

    This part overlaps with another issue that properly injects this service. Lets remove it from that patch.

  2. +++ b/src/Plugin/views/field/PollStatus.php
    @@ -19,7 +19,7 @@ class PollStatus extends FieldPluginBase {
        */
       function render(ResultRow $values) {
    -    $pollStorage = \Drupal::entityManager()->getStorage('poll');
    +    $pollStorage = \Drupal::entityTypeManager()->getStorage('poll');
         $entity = $values->_entity;
    

    This should also be injected.

  3. +++ b/src/PollViewBuilder.php
    @@ -14,7 +14,7 @@ class PollViewBuilder extends EntityViewBuilder {
        */
       public function view(EntityInterface $entity, $view_mode = 'full', $langcode = NULL) {
    -    $entity = $this->entityManager->getTranslationFromContext($entity, $langcode);
    +    $entity = \Drupal::service('entity.repository')->getTranslationFromContext($entity, $langcode);
     
         // Ajax request might send the view mode as a GET argument, use that
    

    And this too.

nkoporec’s picture

Status: Needs work » Needs review
StatusFileSize
new6.98 KB

Created new patch with fix issues that Berdir has raised.

lomasr’s picture

Applied the patch and it worked cleanly for me.

lomasr’s picture

Status: Needs review » Reviewed & tested by the community
berdir’s picture

Did more cleanup, one poll storage was actually unused, also missing docs and incorrect variable names.

When working on an existing patch, please always provide an interdiff.

  • Berdir committed 90d43b3 on 8.x-1.x
    Issue #2870588 by nkoporec, Berdir, Munavijayalakshmi: Removing...
berdir’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.