This class used to allow you to specify service dependencies in the annotation of a Feeds plugin. This is problematic because any plugins extending an existing Feeds plugin are required to declare the same dependencies. And one of the services used by many Feeds plugins is @entity.query, which got deprecated in Drupal 8.3.0.
The use of @entity.query in Feeds plugins will be removed in the next release. This means that if you have plugins that depend on this service, they will keep working for now, but may get broken in the next release. Plugins that for example could get broken are:
- Processor plugins (extending
\Drupal\feeds\Feeds\Processor\EntityProcessorBase) - Target plugins that extend
\Drupal\feeds\Feeds\Target\File
Solution
Instead of using annotation for declaring your dependencies, implement \Drupal\Core\Plugin\ContainerFactoryPluginInterface instead.
Before
/**
* Defines a file upload fetcher.
*
* @FeedsFetcher(
* id = "upload",
* title = @Translation("Upload file"),
* description = @Translation("Upload content from a local file."),
* arguments = {
* "@file.usage",
* "@entity_type.manager",
* "@stream_wrapper_manager"
* },
* form = {
* "configuration" = "Drupal\feeds\Feeds\Fetcher\Form\UploadFetcherForm",
* "feed" = "Drupal\feeds\Feeds\Fetcher\Form\UploadFetcherFeedForm",
* },
* )
*/
class UploadFetcher extends PluginBase implements FetcherInterface {
After
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Defines a file upload fetcher.
*
* @FeedsFetcher(
* id = "upload",
* title = @Translation("Upload file"),
* description = @Translation("Upload content from a local file."),
* form = {
* "configuration" = "Drupal\feeds\Feeds\Fetcher\Form\UploadFetcherForm",
* "feed" = "Drupal\feeds\Feeds\Fetcher\Form\UploadFetcherFeedForm",
* },
* )
*/
class UploadFetcher extends PluginBase implements FetcherInterface, ContainerFactoryPluginInterface {
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$container->get('file.usage'),
$container->get('entity_type.manager'),
$container->get('stream_wrapper_manager')
);
}