Problem/Motivation
Original issue here: #3516034: Add cacheable metadata to SelectInterface and entity QueryInterface objects
This issue introduced the following code and made sure the deprecations being triggered in core were handled. However, we should also deprecate using tagged queries without considering they may carry cacheable metadata, but that will have a far bigger impact and we do not want to pollute the original issues MR with said noise.
The original issue introduced the following code:
if ($cacheableMetadata !== NULL) {
$cacheableMetadata->addCacheableDependency($this);
}
elseif (!empty($this->getCacheContexts()) || !empty($this->getCacheTags()) || $this->getCacheMaxAge() !== Cache::PERMANENT) {
@trigger_error('Calling ' . __METHOD__ . '() without the $cacheableMetadata argument when the query has cacheable metadata is deprecated in drupal:11.5.0 and is removed from drupal:12.0.0. See https://www.drupal.org/node/3610582', E_USER_DEPRECATED);
}
This should become:
if ($cacheableMetadata !== NULL) {
$cacheableMetadata->addCacheableDependency($this);
}
elseif (!empty($this->getCacheContexts()) || !empty($this->getCacheTags()) || $this->getCacheMaxAge() !== Cache::PERMANENT) {
@trigger_error('Calling ' . __METHOD__ . '() without the $cacheableMetadata argument when the query has cacheable metadata is deprecated in drupal:11.5.0 and is removed from drupal:12.0.0. See https://www.drupal.org/node/3610582', E_USER_DEPRECATED);
}
elseif (!empty($this->alterTags)) {
@trigger_error('Calling ' . __METHOD__ . '() without the $cacheableMetadata argument when the query has no cacheable metadata, but is tagged, is deprecated in drupal:11.5.0 and is removed from drupal:12.0.0. See https://www.drupal.org/node/1234567', E_USER_DEPRECATED);
}
Where ideally we replace the check for the alterTags property with a isTagged() method on the AlterableInterface
Steps to reproduce
N/A
Proposed resolution
See summary
Remaining tasks
- Introduce extra deprecation
- See tests explode
- Fix every single item, perhaps in subtasks per system
User interface changes
N/A
Introduced terminology
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A
Comments
Comment #2
kristiaanvandeneynde