class WorkspacesEntityRepository
Same name and namespace in other branches
- 11.x core/modules/workspaces/src/WorkspacesEntityRepository.php \Drupal\workspaces\WorkspacesEntityRepository
Provides workspace-specific mechanisms for retrieving entities.
Hierarchy
- class \Drupal\workspaces\WorkspacesEntityRepository implements \Drupal\Core\Entity\EntityRepositoryInterface
Expanded class hierarchy of WorkspacesEntityRepository
1 string reference to 'WorkspacesEntityRepository'
- workspaces.services.yml in core/
modules/ workspaces/ workspaces.services.yml - core/modules/workspaces/workspaces.services.yml
1 service uses WorkspacesEntityRepository
- workspaces.entity.repository in core/
modules/ workspaces/ workspaces.services.yml - Drupal\workspaces\WorkspacesEntityRepository
File
-
core/
modules/ workspaces/ src/ WorkspacesEntityRepository.php, line 11
Namespace
Drupal\workspacesView source
class WorkspacesEntityRepository implements EntityRepositoryInterface {
public function __construct(protected EntityRepositoryInterface $inner, protected WorkspaceManagerInterface $workspaceManager) {
}
/**
* {@inheritdoc}
*/
public function loadEntityByUuid($entity_type_id, $uuid) {
return $this->inner
->loadEntityByUuid($entity_type_id, $uuid);
}
/**
* {@inheritdoc}
*/
public function loadEntityByConfigTarget($entity_type_id, $target) {
return $this->inner
->loadEntityByConfigTarget($entity_type_id, $target);
}
/**
* {@inheritdoc}
*/
public function getTranslationFromContext(EntityInterface $entity, $langcode = NULL, $context = []) {
return $this->inner
->getTranslationFromContext($entity, $langcode, $context);
}
/**
* {@inheritdoc}
*/
public function getActive($entity_type_id, $entity_id, ?array $contexts = NULL) {
// When there's no active workspace, the active entity variant is the
// canonical one.
if (!$this->workspaceManager
->hasActiveWorkspace()) {
return $this->inner
->getCanonical($entity_type_id, $entity_id, $contexts);
}
return $this->inner
->getActive($entity_type_id, $entity_id, $contexts);
}
/**
* {@inheritdoc}
*/
public function getActiveMultiple($entity_type_id, array $entity_ids, ?array $contexts = NULL) {
// When there's no active workspace, the active entity variant is the
// canonical one.
if (!$this->workspaceManager
->hasActiveWorkspace()) {
return $this->inner
->getCanonicalMultiple($entity_type_id, $entity_ids, $contexts);
}
return $this->inner
->getActiveMultiple($entity_type_id, $entity_ids, $contexts);
}
/**
* {@inheritdoc}
*/
public function getCanonical($entity_type_id, $entity_id, ?array $contexts = NULL) {
return $this->inner
->getCanonical($entity_type_id, $entity_id, $contexts);
}
/**
* {@inheritdoc}
*/
public function getCanonicalMultiple($entity_type_id, array $entity_ids, ?array $contexts = NULL) {
return $this->inner
->getCanonicalMultiple($entity_type_id, $entity_ids, $contexts);
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
|---|---|---|---|---|
| WorkspacesEntityRepository::getActive | public | function | Overrides EntityRepositoryInterface::getActive | |
| WorkspacesEntityRepository::getActiveMultiple | public | function | Overrides EntityRepositoryInterface::getActiveMultiple | |
| WorkspacesEntityRepository::getCanonical | public | function | Overrides EntityRepositoryInterface::getCanonical | |
| WorkspacesEntityRepository::getCanonicalMultiple | public | function | Overrides EntityRepositoryInterface::getCanonicalMultiple | |
| WorkspacesEntityRepository::getTranslationFromContext | public | function | Overrides EntityRepositoryInterface::getTranslationFromContext | |
| WorkspacesEntityRepository::loadEntityByConfigTarget | public | function | Overrides EntityRepositoryInterface::loadEntityByConfigTarget | |
| WorkspacesEntityRepository::loadEntityByUuid | public | function | Overrides EntityRepositoryInterface::loadEntityByUuid | |
| WorkspacesEntityRepository::__construct | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.