class EntityOperations in Workspace 8
Same name and namespace in other branches
- 8.2 src/EntityOperations.php \Drupal\workspace\EntityOperations
Defines a class for reacting to entity events.
Hierarchy
- class \Drupal\workspace\EntityOperations
Expanded class hierarchy of EntityOperations
1 string reference to 'EntityOperations'
1 service uses EntityOperations
File
- src/
EntityOperations.php, line 15
Namespace
Drupal\workspaceView source
class EntityOperations {
/**
* @var \Drupal\multiversion\MultiversionManagerInterface
*/
protected $multiversionManager;
/**
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a new Toolbar.
*
* @param \Drupal\multiversion\MultiversionManagerInterface $multiversion_manager
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* @param \Drupal\Core\Queue\QueueInterface $queue
*/
public function __construct(MultiversionManagerInterface $multiversion_manager, EntityTypeManagerInterface $entity_type_manager, QueueFactory $queue) {
$this->multiversionManager = $multiversion_manager;
$this->entityTypeManager = $entity_type_manager;
$this->queue = $queue;
}
/**
* Hook bridge for hook_workspace_insert()
*
* @see hook_ENTITY_TYPE_insert()
*
* @param \Drupal\multiversion\Entity\WorkspaceInterface $workspace
* The workspace entity that is being created.
*/
public function workspaceInsert(WorkspaceInterface $workspace) {
// Create a new pointer to every Workspace that gets created.
// This is mainly so that we can always backtrack from a Workspace to a
// pointer to provide a consistent API to replicators.
$pointer = $this->entityTypeManager
->getStorage('workspace_pointer')
->create();
$pointer
->setWorkspace($workspace);
$pointer
->save();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityOperations:: |
protected | property | ||
EntityOperations:: |
protected | property | ||
EntityOperations:: |
public | function | Hook bridge for hook_workspace_insert() | |
EntityOperations:: |
public | function | Constructs a new Toolbar. |