Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several classes now require the datetime.time service as a constructor parameter #888

Open
github-actions bot opened this issue Oct 20, 2024 · 0 comments
Labels

Comments

@github-actions
Copy link

https://www.drupal.org/node/3387233

Introduced in branch/version: 10.3.x / 10.3.0

The following classes now require the datetime.time service (\Drupal\Component\Datetime\TimeInterface $time) as a constructor parameter.

These changes are needed to replace calls to the deprecated REQUEST_TIME global constant. (https://www.drupal.org/node/2785211)

  • \Drupal\Core\Asset\JsCollectionRenderer
  • \Drupal\Core\Cache\ApcuBackend
  • \Drupal\Core\Cache\ApcuBackendFactory
  • \Drupal\Core\Cache\DatabaseBackend
  • \Drupal\Core\Cache\DatabaseBackendFactory
  • \Drupal\Core\Cache\MemoryBackend
  • \Drupal\Core\Cache\MemoryBackendFactory
  • \Drupal\Core\Cache\MemoryCounterBackendFactory
  • \Drupal\Core\Cache\PhpBackend
  • \Drupal\Core\Cache\PhpBackendFactory
  • \Drupal\Core\EventSubscriber\FinishResponseSubscriber
  • \Drupal\Core\Flood\DatabaseBackend
  • \Drupal\Core\KeyValueStore\KeyValueDatabaseExpirableFactory
  • \Drupal\Core\KeyValueStore\DatabaseStorageExpirable
  • \Drupal\Core\Session\SessionHandler
  • \Drupal\Core\Session\SessionManager
  • \Drupal\comment\CommentStatistics
  • \Drupal\path_alias\AliasManager
  • \Drupal\search\SearchIndex
  • \Drupal\update\UpdateProcessor
  • \Drupal\user\EventSubscriber\UserRequestSubscriber

For all of the above constructors the protected TimeInterface $time parameter is added as the last of the constructor parameters.

Exception to the parameter order, due to optional parameters, are:

  • \Drupal\Core\Cache\DatabaseBackend
  • Before:
    public function __construct(Connection $connection, CacheTagsChecksumInterface $checksum_provider, $bin, $max_rows = NULL)
    After:
    public function __construct(Connection $connection, CacheTagsChecksumInterface $checksum_provider, $bin, protected TimeInterface $time, $max_rows = NULL)

  • \Drupal\Core\EventSubscriber\FinishResponseSubscriber
  • Before:
    public function __construct(Connection $connection, CacheTagsChecksumInterface $checksum_provider, Settings $settings = NULL)
    After:
    public function __construct(Connection $connection, CacheTagsChecksumInterface $checksum_provider, protected TimeInterface $time, Settings $settings = NULL)

  • \Drupal\Core\Cache\DatabaseBackendFactory
  • Before:
    public function __construct(LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory, RequestPolicyInterface $request_policy, ResponsePolicyInterface $response_policy, CacheContextsManager $cache_contexts_manager, $http_response_debug_cacheability_headers = FALSE)
    After:
    public function __construct(LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory, RequestPolicyInterface $request_policy, ResponsePolicyInterface $response_policy, CacheContextsManager $cache_contexts_manager, protected TimeInterface $time, $http_response_debug_cacheability_headers = FALSE)

  • \Drupal\Core\KeyValueStore\DatabaseStorageExpirable
  • Before:
    public function __construct($collection, SerializationInterface $serializer, Connection $connection, $table = 'key_value_expire')
    After:
    public function __construct($collection, SerializationInterface $serializer, Connection $connection, protected TimeInterface $time, $table = 'key_value_expire')

  • \Drupal\Core\Session\SessionManager
  • Before:
    public function __construct(RequestStack $request_stack, Connection $connection, MetadataBag $metadata_bag, SessionConfigurationInterface $session_configuration, $handler = NULL)

    After:
    public function __construct(RequestStack $request_stack, Connection $connection, MetadataBag $metadata_bag, SessionConfigurationInterface $session_configuration, protected TimeInterface $time, $handler = NULL)

  • \Drupal\comment\CommentStatistics
  • Before:
    public function __construct(Connection $database, AccountInterface $current_user, EntityTypeManagerInterface $entity_type_manager, StateInterface $state, Connection $database_replica = NULL)
    After:
    public function __construct(Connection $database, AccountInterface $current_user, EntityTypeManagerInterface $entity_type_manager, StateInterface $state, protected TimeInterface $time, Connection $database_replica = NULL)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants