Problem/Motivation
This flaw was introduced in #2125717: Migrate in core: patch #1 and also not fixed in #2427335: Combine legacy Source class into SourcePluginBase.
\Drupal\migrate\Plugin\migrate\source\SourcePluginBase::count()
has the infrastructure to enable caching of source counts.
But since \Drupal\migrate\Plugin\migrate\source\SqlBase::count()
overrides \Drupal\migrate\Plugin\migrate\source\SourcePluginBase::count()
, none of that infrastructure can be used by SqlBase
-based @MigrateSource
plugins.
Worse: the vast majority of @MigrateSource
plugins are subclasses of SqlBase
, meaning it the vast majority of @MigrateSource
plugins cannot be made cacheable.
(To make a migration have a cacheable source count, all you need to do is specify cache_counts: true
under the migration definition's source
key. And until #2751829: Default source plugin cache key is insufficiently unique is fixed, you'll also need to specify cache_key
.)
To make these cacheable today, you'd have to patch them.
This would unblock:
- in core: #3190818: [PP-1] Allow source counts to be cached: implement ::doCount() instead of ::count()
- in contrib: metatag: #3190804: [PP-1] Allow source counts to be cached: implement ::doCount() instead of ::count()
- in contrib: media_migration: #3190800: [PP-1] Allow source counts to be cached: implement ::doCount() instead of ::count()