BulkDocsFactory.php in Replication 8.2
File
src/BulkDocsFactory.php
View source
<?php
namespace Drupal\replication;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Lock\LockBackendInterface;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\Core\State\StateInterface;
use Drupal\multiversion\Entity\Index\RevisionIndexInterface;
use Drupal\multiversion\Entity\Index\UuidIndexInterface;
use Drupal\multiversion\Entity\WorkspaceInterface;
use Drupal\multiversion\Workspace\WorkspaceManagerInterface;
use Drupal\replication\BulkDocs\BulkDocs;
class BulkDocsFactory implements BulkDocsFactoryInterface {
protected $workspaceManager;
protected $uuidIndex;
protected $revIndex;
protected $entityTypeManager;
protected $lock;
protected $logger;
protected $instances = [];
protected $state;
public function __construct(WorkspaceManagerInterface $workspace_manager, UuidIndexInterface $uuid_index, RevisionIndexInterface $rev_index, EntityTypeManagerInterface $entity_type_manager, LockBackendInterface $lock, LoggerChannelFactoryInterface $logger_factory, StateInterface $state) {
$this->workspaceManager = $workspace_manager;
$this->uuidIndex = $uuid_index;
$this->revIndex = $rev_index;
$this->entityTypeManager = $entity_type_manager;
$this->lock = $lock;
$this->logger = $logger_factory
->get('replication');
$this->state = $state;
}
public function get(WorkspaceInterface $workspace) {
if (!isset($this->instances[$workspace
->id()])) {
$this->instances[$workspace
->id()] = new BulkDocs($this->workspaceManager, $workspace, $this->uuidIndex, $this->revIndex, $this->entityTypeManager, $this->lock, $this->logger, $this->state);
}
return $this->instances[$workspace
->id()];
}
}