createSubVersionQuery example

/** * Adds a left join with a sub-select to the query that results in the entity version requested in the context or the * live version if that version does not exist. * * @param string $root e.g. "document" * @param string $alias e.g. "document.order" * @param string $source e.g. "document.order_id * @param string $referenceColumn e.g. "id" (for the order) */
    private function joinVersion(AssociationField $field, string $root, string $alias, QueryBuilder $query, Context $context, string $source, string $referenceColumn): void
    {
        $versionQuery = $this->createSubVersionQuery($field$context$this->queryHelper);

        $parameters = [
            '#source#' => $source,
            '#root#' => EntityDefinitionQueryHelper::escape($root),
            '#alias#' => EntityDefinitionQueryHelper::escape($alias),
            '#reference_column#' => $referenceColumn,
        ];

        $query->leftJoin(
            EntityDefinitionQueryHelper::escape($root),
            '(' . $versionQuery->getSQL() . ')',
            
Home | Imprint | This part of the site doesn't use cookies.