addProductStreamTranslation example

->leftJoin('category', 's_product_streams', 'stream', 'category.stream_id = stream.id')
            ->leftJoin('stream', 's_product_streams_attributes', 'productStreamAttribute', 'stream.id = productStreamAttribute.streamId')
            ->where('category.id IN (:categories)')
            ->andWhere('category.active = 1')
            ->andWhere('category.shops IS NULL OR category.shops LIKE :shopId')
            ->addGroupBy('category.id')
            ->setParameter(':categories', $ids, Connection::PARAM_INT_ARRAY)
            ->setParameter(':shopId', '%|' . $context->getShop()->getId() . '|%');

        $this->fieldHelper->addCategoryTranslation($query$context);
        $this->fieldHelper->addMediaTranslation($query$context);
        $this->fieldHelper->addProductStreamTranslation($query$context);
        $this->fieldHelper->addCategoryMainDataTranslation($query$context);

        return $query;
    }

    public function getMapping(array $ids): QueryBuilder
    {
        $query = $this->connection->createQueryBuilder();

        $query->select(['mapping.articleID', 'GROUP_CONCAT(DISTINCT mapping.categoryID)']);

        
$query = $this->connection->createQueryBuilder();

        $query->select(['relation.article_id'])
            ->addSelect($this->fieldHelper->getRelatedProductStreamFields());

        $query->from('s_product_streams_articles', 'relation')
            ->innerJoin('relation', 's_product_streams', 'stream', 'stream.id = relation.stream_id')
            ->leftJoin('stream', 's_product_streams_attributes', 'productStreamAttribute', 'productStreamAttribute.streamID = stream.id')
            ->where('relation.article_id IN (:ids)')
            ->setParameter(':ids', $ids, Connection::PARAM_INT_ARRAY);

        $this->fieldHelper->addProductStreamTranslation($query$context);

        $data = $query->execute()->fetchAll(PDO::FETCH_GROUP);

        $related = [];
        foreach ($data as $productId => $productData) {
            $related[$productId] = [];
            foreach ($productData as $row) {
                $related[$productId][] = $this->hydrator->hydrate($row);
            }
        }

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