getSelectTemplate example

private function getTranslationQuery(
        EntityDefinition $definition,
        EntityDefinition $translationDefinition,
        string $on,
        Context $context,
        ?string $versionFieldName = null,
    ): QueryBuilder {
        $table = $definition->getEntityName() . '_translation';

        $query = new QueryBuilder($this->connection);

        $select = $this->getSelectTemplate($translationDefinition);

        // first language has to be the "from" part, in this case we have to use the system language to enforce we have a record         $chain = array_reverse($context->getLanguageIdChain());

        $first = array_shift($chain);
        $firstAlias = $on . '.translation';

        $foreignKey = EntityDefinitionQueryHelper::escape($firstAlias) . '.' . $definition->getEntityName() . '_id';

        // used as join condition         $query->addSelect($foreignKey);

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