fetchAllAssociativeIndexed example

private function getTranslations(string $objectType, int $objectKey): array
    {
        $queryBuilder = $this->connection->createQueryBuilder();

        return $queryBuilder->select(['objectlanguage as arrayIndex', 'objectlanguage', 'id', 'objectdata', 'objecttype', 'objectkey'])
            ->from('s_core_translations')
            ->where('objecttype = :objecttype')
            ->andWhere('objectkey = :objectkey')
            ->setParameter('objecttype', $objectType)
            ->setParameter('objectkey', $objectKey)
            ->execute()
            ->fetchAllAssociativeIndexed();
    }
}
return 1673426317;
    }

    public function update(Connection $connection): void
    {
        $columns = $connection->executeQuery(' SELECT COLUMN_NAME,DATA_TYPE FROM information_schema.columns WHERE table_schema = :database AND table_name = \'state_machine_history\' AND (COLUMN_NAME = \'referenced_id\' OR COLUMN_NAME = \'referenced_version_id\'); ', ['database' => $connection->getDatabase()])->fetchAllAssociativeIndexed();

        if (!\array_key_exists('referenced_id', $columns)) {
            $connection->executeStatement(' ALTER TABLE `state_machine_history` ADD COLUMN `referenced_id` BINARY(16) GENERATED ALWAYS AS ( COALESCE(UNHEX(JSON_UNQUOTE(JSON_EXTRACT(`entity_id`, \'$.id\'))), 0x0) ) STORED; ');
        }

        


    public function update(Connection $connection): void
    {
        $columns = $connection->executeQuery(' SELECT COLUMN_NAME,EXTRA FROM information_schema.columns WHERE table_schema = :database AND table_name = \'state_machine_history\' AND (COLUMN_NAME = \'referenced_id\' OR COLUMN_NAME = \'referenced_version_id\' OR COLUMN_NAME = \'entity_id\'); ', ['database' => $connection->getDatabase()])->fetchAllAssociativeIndexed();

        if ($columns['referenced_id']['EXTRA'] === 'STORED GENERATED') {
            $connection->executeStatement(' ALTER TABLE `state_machine_history` MODIFY COLUMN `referenced_id` BINARY(16) NOT NULL; ');
        }

        if ($columns['referenced_version_id']['EXTRA'] === 'STORED GENERATED') {
            $connection->executeStatement(' ALTER TABLE `state_machine_history` MODIFY COLUMN `referenced_version_id` BINARY(16) NOT NULL; ');
if ($limit > -1) {
            $sql .= ' LIMIT :limit OFFSET :offset';
            $payload['limit'] = $limit;
            $payload['offset'] = $offset;
            $types = [
                'offset' => \PDO::PARAM_INT,
                'limit' => \PDO::PARAM_INT,
            ];
        }

        /** @var array<string, array{count: int, key: string, cluster: string, pool: string}> $result */
        $result = $this->connection->fetchAllAssociativeIndexed($sql$payload$types);

        return $result;
    }
}
SQL;

        /** @var array<string, array{id: string, property_group_id: string, translations: string}> $options */
        $options = $this->connection->fetchAllAssociativeIndexed(
            $sql,
            [
                'ids' => Uuid::fromHexToBytesList($propertyIds),
                'languageIds' => Uuid::fromHexToBytesList($context->getLanguageIdChain()),
            ],
            [
                'ids' => ArrayParameterType::STRING,
                'languageIds' => ArrayParameterType::STRING,
            ]
        );

        
SQL;

        /** @var array<string, array<string, string>> $result */
        $result = $this->connection->fetchAllAssociativeIndexed(
            $sql,
            [
                'ids' => $ids,
                'liveVersionId' => Uuid::fromHexToBytes($context->getVersionId()),
            ],
            [
                'ids' => ArrayParameterType::STRING,
            ]
        );

        return $result;
    }
SELECT order_line_item.id, quantity, referenced_id, state_machine_state.technical_name AS order_status FROM order_line_item INNER JOIN `order` ON order_line_item.order_id = `order`.id AND `order`.version_id = :version INNER JOIN state_machine_state ON `order`.state_id = state_machine_state.id WHERE order_line_item.id IN (:ids) AND order_line_item.version_id = :version AND type = :type AND state_machine_state.technical_name != :cancelled_state SQL;

        /** @var array<string, array{id: string, quantity: int, referenced_id: string}> $result */
        $result = $this->connection->fetchAllAssociativeIndexed(
            $sql,
            ['ids' => $ids, 'version' => Uuid::fromHexToBytes(Defaults::LIVE_VERSION), 'type' => LineItem::PRODUCT_LINE_ITEM_TYPE, 'cancelled_state' => OrderStates::STATE_CANCELLED],
            ['ids' => ArrayParameterType::STRING]
        );

        return $result;
    }

    /** * @return list<array{id: string, product_id: string, quantity: int}> */
    
return array_merge(
            $extensions,
            $namespaceHierarchy
        );
    }

    /** * @return array<mixed, array<string, mixed>> */
    private function getAppTemplateNamespaces(): array
    {
        return $this->connection->fetchAllAssociativeIndexed(
            'SELECT `app`.`name`, `app`.`version`, `app`.`template_load_priority` FROM `app` INNER JOIN `app_template` ON `app_template`.`app_id` = `app`.`id` WHERE `app`.`active` = 1 AND `app_template`.`active` = 1'
        );
    }
}
private function dbHasTable(string $tableName): bool
    {
        return EntityDefinitionQueryHelper::tableExists($this->connection, $tableName);
    }

    /** * @return array<int, string|int> */
    private function getTableColumns(string $tableName): array
    {
        return \array_keys(
            $this->connection->fetchAllAssociativeIndexed(
                "SHOW COLUMNS FROM $tableName"
            )
        );
    }

    /** * @return array<mixed> */
    private function jsonDecode(string $json): array
    {
        return \json_decode($json, true, 512, \JSON_THROW_ON_ERROR);
    }

                'orderAware',
                'customerAware',
            ],
            $requirements
        );

        $headlines = $this->getContainer()
            ->get(Connection::class)
            ->executeQuery('SELECT `headline` FROM `app_flow_action_translation` WHERE `app_flow_action_id` = :id', [
                'id' => $appFlowAction['id'],
            ])->fetchAllAssociativeIndexed();

        static::assertTrue(\in_array('The headline App Flow Action', \array_keys($headlines), true));
        static::assertTrue(\in_array('Die Überschrift App Flow Action', \array_keys($headlines), true));
    }

    private function assertDefaultHosts(AppEntity $app): void
    {
        static::assertEquals([
            'my.app.com',
            'test.com',
            'base-url.com',
            
{$this->customerGroupId} WHERE a.active = 1 AND ag.articleID IS NULL GROUP BY a.id ORDER BY COUNT(r.articleID) DESC LIMIT $tagSize ";

        $products = $this->connection->executeQuery($sql)->fetchAllAssociativeIndexed();

        if (empty($products)) {
            return [];
        }
        $products = $this->productModule->sGetTranslations($products, 'article');

        $pos = 1;
        $productCount = \count($products);
        if (!empty($this->config->get('sTAGCLOUDSPLIT'))) {
            $steps = (int) $this->config->get('sTAGCLOUDSPLIT');
        } else {
            
/** * @param array<string, array<string, mixed>> $customEntities */
    public function update(
        array $customEntities,
        ?string $extensionEntityType = null,
        ?string $extensionId = null
    ): void {
        $names = array_column($customEntities, 'name');

        $existings = $this->connection->fetchAllAssociativeIndexed(
            'SELECT `name`, LOWER(HEX(id)) as id, created_at FROM custom_entity WHERE `name` IN (:names)',
            ['names' => $names],
            ['names' => ArrayParameterType::STRING]
        );

        if ($extensionEntityType === PluginEntity::class && $extensionId) {
            $this->connection->executeStatement(
                'DELETE FROM custom_entity WHERE plugin_id = :id',
                ['id' => Uuid::fromHexToBytes($extensionId)]
            );
        } elseif ($extensionEntityType === AppEntity::class && $extensionId) {
            
Home | Imprint | This part of the site doesn't use cookies.