public function WorkspaceAssociationStorage::getEntityTrackingWorkspaceIds in Workspace 8.2
Gets a list of workspace IDs in which an entity is tracked.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: An entity object.
Return value
string[] An array of workspace IDs where the given entity is tracked, or an empty array if it is not tracked anywhere.
Overrides WorkspaceAssociationStorageInterface::getEntityTrackingWorkspaceIds
File
- src/
WorkspaceAssociationStorage.php, line 49
Class
- WorkspaceAssociationStorage
- Defines the storage handler class for the Workspace association entity type.
Namespace
Drupal\workspaceCode
public function getEntityTrackingWorkspaceIds(EntityInterface $entity) {
$query = $this->database
->select($this
->getBaseTable(), 'base_table');
$query
->fields('base_table', [
'workspace',
])
->condition('target_entity_type_id', $entity
->getEntityTypeId())
->condition('target_entity_id', $entity
->id());
return $query
->execute()
->fetchCol();
}