Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/workspaces/src/EntityQuery/Tables.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | a9cd425dd02b |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
95 $condition_parts = explode(' = ', $join_condition); | 95 $condition_parts = explode(' = ', $join_condition); |
96 list($base_table, $id_field) = explode('.', $condition_parts[1]); | 96 list($base_table, $id_field) = explode('.', $condition_parts[1]); |
97 | 97 |
98 if (isset($this->baseTablesEntityType[$base_table])) { | 98 if (isset($this->baseTablesEntityType[$base_table])) { |
99 $entity_type_id = $this->baseTablesEntityType[$base_table]; | 99 $entity_type_id = $this->baseTablesEntityType[$base_table]; |
100 $revision_key = $this->entityManager->getDefinition($entity_type_id)->getKey('revision'); | 100 $revision_key = $this->entityTypeManager->getActiveDefinition($entity_type_id)->getKey('revision'); |
101 | 101 |
102 if ($id_field === $revision_key || $id_field === 'revision_id') { | 102 if ($id_field === $revision_key || $id_field === 'revision_id') { |
103 $workspace_association_table = $this->contentWorkspaceTables[$base_table]; | 103 $workspace_association_table = $this->contentWorkspaceTables[$base_table]; |
104 $join_condition = "{$condition_parts[0]} = COALESCE($workspace_association_table.target_entity_revision_id, {$condition_parts[1]})"; | 104 $join_condition = "{$condition_parts[0]} = COALESCE($workspace_association_table.target_entity_revision_id, {$condition_parts[1]})"; |
105 } | 105 } |
139 * @return string | 139 * @return string |
140 * The alias of the joined table. | 140 * The alias of the joined table. |
141 */ | 141 */ |
142 public function addWorkspaceAssociationJoin($entity_type_id, $base_table_alias, $active_workspace_id) { | 142 public function addWorkspaceAssociationJoin($entity_type_id, $base_table_alias, $active_workspace_id) { |
143 if (!isset($this->contentWorkspaceTables[$base_table_alias])) { | 143 if (!isset($this->contentWorkspaceTables[$base_table_alias])) { |
144 $entity_type = $this->entityManager->getDefinition($entity_type_id); | 144 $entity_type = $this->entityTypeManager->getActiveDefinition($entity_type_id); |
145 $id_field = $entity_type->getKey('id'); | 145 $id_field = $entity_type->getKey('id'); |
146 | 146 |
147 // LEFT join the Workspace association entity's table so we can properly | 147 // LEFT join the Workspace association entity's table so we can properly |
148 // include live content along with a possible workspace-specific revision. | 148 // include live content along with a possible workspace-specific revision. |
149 $this->contentWorkspaceTables[$base_table_alias] = $this->sqlQuery->leftJoin('workspace_association', NULL, "%alias.target_entity_type_id = '$entity_type_id' AND %alias.target_entity_id = $base_table_alias.$id_field AND %alias.workspace = '$active_workspace_id'"); | 149 $this->contentWorkspaceTables[$base_table_alias] = $this->sqlQuery->leftJoin('workspace_association', NULL, "%alias.target_entity_type_id = '$entity_type_id' AND %alias.target_entity_id = $base_table_alias.$id_field AND %alias.workspace = '$active_workspace_id'"); |