Change record status: 
Project: 
Introduced in branch: 
2.0.x
Introduced in version: 
2.0.x-alpha1
Description: 

Following release note covers all important changes you need to take into consideration when upgrading from 8.x-1.x to 2.0.x. If you have no (custom) modules that extend Poll functionality you should be safe.

If you are extending the Poll module take note of following changes.

Constants moved and renamed

Before:

...
$query->condition('status', POLL_PUBLISHED);
$query->condition('status', POLL_NOT_PUBLISHED);
...

After:

...
$query->condition('status', PollInterface::PUBLISHED);
$query->condition('status', PollInterface::NOT_PUBLISHED);
...

Alternatively you can use TRUE|FALSE.

Extra dependencies to inject

Following services have additional services to be injected.

  • poll.post_render_cache
  • poll_vote.storage

poll.post_render_cache

Before:

services:
  my_module.post_render_cache:
    class: Drupal\my_module\MyCustomPollPostRenderCache
    arguments: ['@entity_type.manager', '@SOME_OTHER_THING']
<?php

namespace Drupal\my_module;

use Drupal\Core\Entity\EntityTypeManagerInterface;

class MyCustomPollPostRenderCache extends PollPostRenderCache {

  public function __construct(EntityTypeManagerInterface $entity_type_manager) {
    parent::__construct($entity_type_manager);
    ...
  }

}

After:

services:
  my_module.post_render_cache:
    class: Drupal\my_module\MyCustomPollPostRenderCache
    arguments: ['@entity_type.manager', '@class_resolver', '@form_builder', '@request_stack', '@SOME_OTHER_THING']
<?php

namespace Drupal\my_module;

use Drupal\Core\DependencyInjection\ClassResolverInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\RequestStack;

class MyCustomPollPostRenderCache extends PollPostRenderCache {

  public function __construct(EntityTypeManagerInterface $entity_type_manager, ClassResolverInterface $class_resolver, FormBuilderInterface $form_builder, RequestStack $request_stack) {
    parent::__construct($entity_type_manager, $class_resolver, $form_builder, $request_stack);
    ...
  }

}

poll_vote.storage

Before:

services:
  my_module.storage:
    class: Drupal\my_module\MyPollVoteStorage
    arguments: ['@database', '@cache_tags.invalidator', '@SOME_OTHER_THING']
<?php

namespace Drupal\my_module;

use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
use Drupal\Core\Database\Connection;

class MyPollVoteStorage extends PollVoteStorage {

  public function __construct(Connection $connection, CacheTagsInvalidatorInterface $cache_tags_invalidator) {
    parent::__construct($connection, $cache_tags_invalidator);
    ...
  }

}

After:

services:
  my_module.storage:
    class: Drupal\my_module\MyPollVoteStorage
    arguments: ['@database', '@cache_tags.invalidator', '@current_user' ,'@request_stack', '@SOME_OTHER_THING']
<?php

namespace Drupal\my_module;

use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
use Drupal\Core\Database\Connection;
use Drupal\Core\Session\AccountProxyInterface;
use Symfony\Component\HttpFoundation\RequestStack;

class MyPollVoteStorage extends PollVoteStorage {

  public function __construct(Connection $connection, CacheTagsInvalidatorInterface $cache_tags_invalidator, AccountProxyInterface $current_user, RequestStack $request_stack) {
    parent::__construct($connection, $cache_tags_invalidator, $current_user, $request_stack);
    ...
  }

}
Impacts: 
Site builders, administrators, editors
Module developers