from example

$this->authorizeBrowserWithIntegration($apiBrowser$id);

        return $this->integrationBrowser = $apiBrowser;
    }

    private function getLocaleOfSystemLanguage(Connection $connection): string
    {
        $builder = $connection->createQueryBuilder();

        return (string) $builder->select('locale.id')
            ->from('language', 'language')
            ->innerJoin('language', 'locale', 'locale', 'language.locale_id = locale.id')
            ->where('language.id = :id')
            ->setParameter('id', Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM))
            ->executeQuery()
            ->fetchOne();
    }
}

    public function authenticate()
    {
        $result = parent::authenticate();

        $select = $this->_zendDb->select();
        $select->from($this->_tableName);
        $select->where($this->_zendDb->quoteIdentifier($this->_identityColumn, true) . ' = ?', $this->_identity);
        $user = $this->_zendDb->fetchRow($select[], Zend_Db::FETCH_OBJ);

        if ($result->isValid()) {
            // Check if user role is active             $sql = 'SELECT enabled FROM s_core_auth_roles WHERE id = ?';
            if ($this->_zendDb->fetchOne($sql[$user->roleID]) == false) {
                return new Zend_Auth_Result(
                    Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND,
                    $this->_identity,
                    []
                );

        $ids = [];
        foreach ($products as $product) {
            $ids[] = $product->getId();
        }
        $ids = array_unique($ids);

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

        $query->select(['product.id', 'relatedVariant.ordernumber as number']);

        $query->from('s_articles_relationships', 'relation')
            ->innerJoin('relation', 's_articles', 'product', 'product.id = relation.articleID')
            ->innerJoin('relation', 's_articles', 'relatedArticles', 'relatedArticles.id = relation.relatedArticle')
            ->innerJoin('relatedArticles', 's_articles_details', 'relatedVariant', 'relatedVariant.id = relatedArticles.main_detail_id')
            ->where('product.id IN (:ids)')
            ->setParameter(':ids', $ids, Connection::PARAM_INT_ARRAY);

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

        $related = [];
        foreach ($data as $productId => $row) {
            $related[$productId] = array_column($row, 'number');
        }
$params['birthday'] = null;
        }

        return $params;
    }

    private function fetchCustomerStreams(int $id): string
    {
        $query = $this->container->get(Connection::class)->createQueryBuilder();

        $ids = $query->select(['mapping.stream_id'])
            ->from('s_customer_streams_mapping', 'mapping')
            ->innerJoin('mapping', 's_customer_streams', 'streams', 'streams.id = mapping.stream_id')
            ->where('mapping.customer_id = :id')
            ->addOrderBy('streams.name', 'ASC')
            ->setParameter(':id', $id)
            ->execute()
            ->fetchAll(PDO::FETCH_COLUMN);

        return implode('|', $ids);
    }
}


    /** * @return void */
    public function loadSelectedProductsAction()
    {
        $streamId = $this->Request()->getParam('streamId');
        $query = Shopware()->Container()->get(Connection::class)->createQueryBuilder();

        $query->select(['product.id', 'variant.ordernumber as number', 'product.name'])
            ->from('s_articles', 'product')
            ->innerJoin('product', 's_product_streams_selection', 'streamProducts', 'streamProducts.article_id = product.id')
            ->innerJoin('product', 's_articles_details', 'variant', 'variant.id = product.main_detail_id')
            ->where('streamProducts.stream_id = :streamId')
            ->setParameter(':streamId', $streamId)
            ->setFirstResult($this->Request()->getParam('start', 0))
            ->setMaxResults($this->Request()->getParam('limit', 25))
        ;

        $products = $query->execute()->fetchAll(PDO::FETCH_ASSOC);

        $query->select('COUNT(product.id) as counter')
            

    public function getArticleImpressionQueryBuilder($articleId$shopId$date$deviceType = null)
    {
        $builder = $this->getEntityManager()->createQueryBuilder();
        $builder->select('articleImpression')
                ->from(ArticleImpression::class, 'articleImpression')
                ->where('articleImpression.articleId = :articleId')
                ->andWhere('articleImpression.shopId = :shopId')
                ->andWhere('articleImpression.date = :fromDate')
                ->setParameter('articleId', $articleId)
                ->setParameter('shopId', $shopId)
                ->setParameter('fromDate', $date->format('Y-m-d'));

        if ($deviceType) {
            $builder->andWhere('articleImpression.deviceType = :deviceType')
                ->setParameter('deviceType', $deviceType);
        }

        

    public function getIdFromNumber($number)
    {
        if (empty($number)) {
            throw new ParameterMissingException('id');
        }

        $builder = Shopware()->Models()->createQueryBuilder();
        $builder->select(['customer.id'])
                ->from(CustomerModel::class, 'customer')
                ->where('customer.number = ?1')
                ->setParameter(1, $number);

        try {
            $id = $builder->getQuery()->getOneOrNullResult();
        } catch (NonUniqueResultException $nonUniqueResultException) {
            $ids = $builder->getQuery()->getArrayResult();
            throw new NonUniqueIdentifierUsedException('number', (string) $number, CustomerModel::classarray_column($ids, 'id'));
        }

        if (!$id) {
            
return $result;
    }

    private function getQuery(ShopContextInterface $context): QueryBuilder
    {
        $query = $this->connection->createQueryBuilder();

        $query->addSelect('variant.ordernumber as number')
            ->addSelect($this->fieldHelper->getMediaFields())
            ->addSelect($this->fieldHelper->getImageFields());

        $query->from('s_articles_img', 'image')
            ->innerJoin('image', 's_media', 'media', 'image.media_id = media.id')
            ->innerJoin('media', 's_media_album_settings', 'mediaSettings', 'mediaSettings.albumID = media.albumID')
            ->innerJoin('image', 's_articles_img', 'childImage', 'childImage.parent_id = image.id')
            ->innerJoin('image', 's_articles_details', 'variant', 'variant.id = childImage.article_detail_id')
            ->leftJoin('image', 's_media_attributes', 'mediaAttribute', 'mediaAttribute.mediaID = image.media_id')
            ->leftJoin('image', 's_articles_img_attributes', 'imageAttribute', 'imageAttribute.imageID = image.id');

        $this->fieldHelper->addImageTranslation($query$context);
        $this->fieldHelper->addMediaTranslation($query$context);

        return $query;
    }
if ($table === null) {
            throw new RuntimeException('Invalid parameter "_repositoryClass" given');
        }

        $data = [];
        if (isset($filter[0]['property']) && $filter[0]['property'] === 'name') {
            $search = $filter[0]['value'];
        }
        switch ($name) {
            case 'cronJob':
                $select = Shopware()->Db()->select();
                $select->from(['c' => $table]);
                if (isset($search)) {
                    $select->where(
                        'c.name LIKE :search OR c.action LIKE :search'
                    );
                    $select->bind(
                        [
                            'search' => $search,
                        ]
                    );
                }
                $select->limit($limit$start);
                
$this->_zendDb->quoteIdentifier($this->_credentialColumn, true)
                . ' = ' . $this->_credentialTreatment, $this->_credential
                )
            . ' THEN 1 ELSE 0 END) AS '
            . $this->_zendDb->quoteIdentifier(
                $this->_zendDb->foldCase('zend_auth_credential_match')
                )
            );

        // get select         $dbSelect = clone $this->getDbSelect();
        $dbSelect->from($this->_tableName, ['*', $credentialExpression])
                 ->where($this->_zendDb->quoteIdentifier($this->_identityColumn, true) . ' = ?', $this->_identity);

        return $dbSelect;
    }

    /** * _authenticateQuerySelect() - This method accepts a Zend_Db_Select object and * performs a query against the database with that object. * * @param Zend_Db_Select $dbSelect * * @throws Zend_Auth_Adapter_Exception - when an invalid select * object is encountered * * @return array */
->setParameter(':shop', $context->getShopId())
            ->execute()
            ->fetchColumn();
    }

    /** * @return QueryBuilder */
    protected function getBaseQuery()
    {
        return $this->connection->createQueryBuilder()
            ->from('s_emotion', 'emo')
            ->join(
                'emo',
                's_emotion_categories',
                'emo_cat',
                'emo.id = emo_cat.emotion_id'
            )
            ->leftJoin('emo_cat', 's_categories', 'cat', 'emo_cat.category_id = cat.id')
            ->where('emo.active = 1')
            ->andWhere(sprintf('emo_cat.category_id IN (%s)', $this->prepareSubQuery()->getSQL()))
            ->andWhere('emo.valid_to > NOW() OR emo.valid_to IS NULL');
    }

    
/** @var MigrationSource $source */
        $source = $this->getContainer()->get(MigrationSource::class D '.core');

        iterator_to_array($runtime->migrate($source), true);
    }

    private function getMigrations(): array
    {
        return $this->connection->createQueryBuilder()
            ->select('*')
            ->from('migration')
            ->where('`class` LIKE \'%_test_migrations_valid_run_time%\' OR `class` LIKE \'%_test_migrations_valid_run_time_exceptions%\'')
            ->orderBy('creation_timestamp', 'ASC')
            ->executeQuery()
            ->fetchAllAssociative();
    }
}

    private function getExclusionIds(string $id): array
    {
        if (!Uuid::isValid($id)) {
            return [];
        }

        $query = $this->connection->createQueryBuilder();
        $query->select('ifnull(exclusion_ids,JSON_ARRAY()) as exclusion_ids');
        $query->from(PromotionDefinition::ENTITY_NAME);
        $query->andWhere($query->expr()->eq('id', ':id'));

        $query->setParameter('id', Uuid::fromHexToBytes($id));

        return $query->executeQuery()->fetchAllAssociative();
    }

    /** * helper function to convert hex array values to a binary array * * @param array<string> $hexIds */

    public function getAlbumsAction()
    {
        $builder = $this->get('models')->createQueryBuilder();
        $albumId = $this->Request()->getParam('albumId');

        $builder->select(['album'])
            ->from(Album::class, 'album')
            ->where('album.parentId IS NULL')
            ->orderBy('album.position', 'ASC');

        if (!empty($albumId)) {
            $albumId = explode(',', $albumId);
            $builder->andWhere('album.id IN(:albumId)')
                ->setParameter('albumId', $albumId);
        }

        $albums = $builder->getQuery()->getResult();

        

        return (int) $this->getBaseQuery()
            ->addSelect(['COUNT(id)'])
            ->setParameter(':shop', $context->getShopId())
            ->execute()
            ->fetchColumn();
    }

    protected function getBaseQuery(): QueryBuilder
    {
        return $this->connection->createQueryBuilder()
            ->from('s_cms_support')
            ->where('active = 1')
            ->andWhere('shop_ids IS NULL OR shop_ids LIKE CONCAT("%|",:shop,"|%")');
    }
}
Home | Imprint | This part of the site doesn't use cookies.