joinVersion example

$query->from(self::escape($table));

        $useVersionFallback // only applies for versioned entities             = $definition->isVersionAware()
            // only add live fallback if the current version isn't the live version             && $context->getVersionId() !== Defaults::LIVE_VERSION
            // sub entities have no live fallback             && $definition->getParentDefinition() === null;

        if ($useVersionFallback) {
            $this->joinVersion($query$definition$definition->getEntityName()$context);
        } elseif ($definition->isVersionAware()) {
            $versionIdField = array_filter(
                $definition->getPrimaryKeys()->getElements(),
                fn ($f) => $f instanceof VersionField || $f instanceof ReferenceVersionField
            );

            if (!$versionIdField) {
                throw new \RuntimeException('Missing `VersionField` in `' . $definition->getClass() . '`');
            }

            /** @var FkField $versionIdField */
            
$table = $reference->getEntityName();

        $versionAware = $context->getDefinition()->isVersionAware() && $reference->isVersionAware();

        $source = $this->getSourceColumn($context->getDefinition()$field$context->getAlias()$context->getContext());

        $referenceColumn = $this->getReferenceColumn($field$context->getContext());

        // specified version requested, use sub version call to solve live version or specified         if ($versionAware && $context->getContext()->getVersionId() !== Defaults::LIVE_VERSION) {
            $this->joinVersion($field$context->getAlias()$alias$context->getQuery()$context->getContext()$source$referenceColumn);

            return $alias;
        }

        // No Blacklisting Whitelisting for ManyToOne Association because of possible Dependencies on subentities         $parameters = [
            '#source#' => $source,
            '#root#' => EntityDefinitionQueryHelper::escape($context->getAlias()),
            '#alias#' => EntityDefinitionQueryHelper::escape($alias),
            '#reference_column#' => $referenceColumn,
        ];

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