DeleteOrphan.php in Organic groups 8
File
src/Plugin/QueueWorker/DeleteOrphan.php
View source
<?php
declare (strict_types=1);
namespace Drupal\og\Plugin\QueueWorker;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Queue\QueueWorkerBase;
use Drupal\og\OgDeleteOrphansPluginManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
class DeleteOrphan extends QueueWorkerBase implements ContainerFactoryPluginInterface {
protected $ogDeleteOrphansPluginManager;
public function __construct(array $configuration, $plugin_id, $plugin_definition, OgDeleteOrphansPluginManager $og_delete_orphans_plugin_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->ogDeleteOrphansPluginManager = $og_delete_orphans_plugin_manager;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('plugin.manager.og.delete_orphans'));
}
public function processItem($data) {
$this->ogDeleteOrphansPluginManager
->createInstance('cron', [])
->processItem($data);
}
}