addNextBaseTable example


      }
    }

    return parent::addJoin($type$table$join_condition$langcode$delta);
  }

  /** * {@inheritdoc} */
  protected function addNextBaseTable(EntityType $entity_type$table$sql_column, FieldStorageDefinitionInterface $field_storage) {
    $next_base_table_alias = parent::addNextBaseTable($entity_type$table$sql_column$field_storage);

    $active_workspace_id = $this->sqlQuery->getMetaData('active_workspace_id');
    if ($active_workspace_id && $this->workspaceManager->isEntityTypeSupported($entity_type)) {
      $this->addWorkspaceAssociationJoin($entity_type->id()$next_base_table_alias$active_workspace_id);
    }

    return $next_base_table_alias;
  }

  /** * Adds a new join to the 'workspace_association' table for an entity base table. * * This method assumes that the active workspace has already been determined * to be a non-default workspace. * * @param string $entity_type_id * The ID of the entity type whose base table we are joining. * @param string $base_table_alias * The alias of the entity type's base table. * @param string $active_workspace_id * The ID of the active workspace. * * @return string * The alias of the joined table. */
// Check for a valid relationship.         if (isset($propertyDefinitions[$relationship_specifier]) && $propertyDefinitions[$relationship_specifier] instanceof DataReferenceDefinitionInterface) {
          // If it is, use the entity type if specified already, otherwise use           // the definition.           $target_definition = $propertyDefinitions[$relationship_specifier]->getTargetDefinition();
          if (!$entity_type_id && $target_definition instanceof EntityDataDefinitionInterface) {
            $entity_type_id = $target_definition->getEntityTypeId();
          }
          $entity_type = $this->entityTypeManager->getActiveDefinition($entity_type_id);
          $field_storage_definitions = $this->entityFieldManager->getActiveFieldStorageDefinitions($entity_type_id);
          // Add the new entity base table using the table and sql column.           $base_table = $this->addNextBaseTable($entity_type$table$sql_column$field_storage);
          $propertyDefinitions = [];
          $key++;
          $index_prefix .= "$next_index_prefix.";
        }
        else {
          throw new QueryException("Invalid specifier '$relationship_specifier'");
        }
      }
    }
    return "$table.$sql_column";
  }

  
Home | Imprint | This part of the site doesn't use cookies.