function WorkspaceTestTrait::getUnassociatedRevisions
Same name in other branches
- 9 core/modules/workspaces/tests/src/Kernel/WorkspaceTestTrait.php \Drupal\Tests\workspaces\Kernel\WorkspaceTestTrait::getUnassociatedRevisions()
- 8.9.x core/modules/workspaces/tests/src/Kernel/WorkspaceTestTrait.php \Drupal\Tests\workspaces\Kernel\WorkspaceTestTrait::getUnassociatedRevisions()
- 11.x core/modules/workspaces/tests/src/Kernel/WorkspaceTestTrait.php \Drupal\Tests\workspaces\Kernel\WorkspaceTestTrait::getUnassociatedRevisions()
Returns all the revisions which are not associated with any workspace.
Parameters
string $entity_type_id: An entity type ID to find revisions for.
int[]|string[]|null $entity_ids: (optional) An array of entity IDs to filter the results by. Defaults to NULL.
Return value
array An array of entity IDs, keyed by revision IDs.
File
-
core/
modules/ workspaces/ tests/ src/ Kernel/ WorkspaceTestTrait.php, line 136
Class
- WorkspaceTestTrait
- A trait with common workspaces testing functionality.
Namespace
Drupal\Tests\workspaces\KernelCode
protected function getUnassociatedRevisions($entity_type_id, $entity_ids = NULL) {
$entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id);
$query = \Drupal::entityTypeManager()->getStorage($entity_type_id)
->getQuery()
->allRevisions()
->accessCheck(FALSE)
->notExists($entity_type->get('revision_metadata_keys')['workspace']);
if ($entity_ids) {
$query->condition($entity_type->getKey('id'), $entity_ids, 'IN');
}
return $query->execute();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.