eq example

if (!empty($filter)) {
            $builder->addFilter($filter);
        }
        if (!empty($sort)) {
            $builder->addOrderBy($sort);
        }

        $expr = $this->getManager()->getExpressionBuilder();
        $builder->andWhere(
            $expr->orX(
                $expr->eq($association['fieldName'] . '.id', ':id')
            )
        );
        $builder->setParameter('id', $id);

        $builder->setFirstResult($offset)
            ->setMaxResults($limit);

        $paginator = $this->getQueryPaginator($builder);

        $data = iterator_to_array($paginator);

        
public function readValues(string $pluginName, ?int $shopId): array
    {
        return parent::readValues($pluginName, 1);
    }

    protected function configureQuery(QueryBuilder $builder, ?int $shopId, string $pluginName): QueryBuilder
    {
        $shopIdKey = 'shopId' . abs(crc32((string) $shopId));
        $pluginNameKey = 'pluginName' . abs(crc32($pluginName));

        return $builder
            ->andWhere($builder->expr()->eq('corePlugins.name', ':' . $pluginNameKey))
            ->andWhere($builder->expr()->eq('coreConfigValues.shop_id', ':' . $shopIdKey))
            ->setParameter($pluginNameKey$pluginName)
            ->setParameter($shopIdKey$shopId);
    }

    protected function isLayerResponsible(?int $shopId): bool
    {
        if ($shopId === 1 || $shopId === null) {
            return true;
        }

        
if ($value === null || $value === '') {
            return;
        }

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

        /** @var array{email: string, guest: int, bound_sales_channel_id: string|null}[] $results */
        $results = $query
            ->select('email', 'guest', 'LOWER(HEX(bound_sales_channel_id)) as bound_sales_channel_id')
            ->from('customer')
            ->where($query->expr()->eq('email', $query->createPositionalParameter($value)))
            ->executeQuery()
            ->fetchAllAssociative();

        $results = \array_filter($resultsstatic function Darray $entry) use ($constraint) {
            // Filter out guest entries             if ($entry['guest']) {
                return null;
            }

            if ($entry['bound_sales_channel_id'] === null) {
                return true;
            }
return [];
    }

    /** * {@inheritdoc} */
    public function completeArgumentValues($argumentName, CompletionContext $context)
    {
        if ($argumentName === 'plugin') {
            $repository = $this->getContainer()->get(ModelManager::class)->getRepository(Plugin::class);
            $queryBuilder = $repository->createQueryBuilder('plugin');
            $result = $queryBuilder->andWhere($queryBuilder->expr()->eq('plugin.capabilityEnable', 'true'))
                ->andWhere($queryBuilder->expr()->eq('plugin.active', 'true'))
                ->andWhere($queryBuilder->expr()->isNotNull('plugin.installed'))
                ->select(['plugin.name'])
                ->getQuery()
                ->getArrayResult();

            return array_column($result, 'name');
        }

        return [];
    }

    
$doc = new \DOMDocument();
        $node = $doc->createElement('test');

        $crawler = $this->createCrawler($node);
        $crawler->clear();
        $this->assertCount(0, $crawler, '->clear() removes all the nodes from the crawler');
    }

    public function testEq()
    {
        $crawler = $this->createTestCrawler()->filterXPath('//li');
        $this->assertNotSame($crawler$crawler->eq(0), '->eq() returns a new instance of a crawler');
        $this->assertInstanceOf(Crawler::class$crawler->eq(0), '->eq() returns a new instance of a crawler');

        $this->assertEquals('Two', $crawler->eq(1)->text(), '->eq() returns the nth node of the list');
        $this->assertCount(0, $crawler->eq(100), '->eq() returns an empty crawler if the nth node does not exist');
    }

    public function testNormalizeWhiteSpace()
    {
        $crawler = $this->createTestCrawler()->filterXPath('//p');
        $this->assertSame('Elsa <3', $crawler->text(null, true), '->text(null, true) returns the text with normalized whitespace');
        $this->assertNotSame('Elsa <3', $crawler->text(null, false));
    }
// Identify each field placeholder value with table alias and a hash of condition properties         $boundParamName = sprintf(':%s_%s', $tableAliasmd5($field . $operator . json_encode($value)));
        $field = sprintf('%s.%s', $tableAlias$field);

        switch (true) {
            case $operator === Condition::OPERATOR_EQ:
                if ($value === null) {
                    $query->andWhere($query->expr()->isNull($field));
                    break;
                }
                $query->andWhere($query->expr()->eq($field$boundParamName));
                $query->setParameter($boundParamName$value);
                break;

            case $operator === Condition::OPERATOR_NEQ:
                if ($value === null) {
                    $query->andWhere($query->expr()->isNotNull($field));
                    break;
                }
                $query->andWhere($query->expr()->neq($field$boundParamName));
                $query->setParameter($boundParamName$value);
                break;

            
return [];
    }

    /** * {@inheritdoc} */
    public function completeArgumentValues($argumentName, CompletionContext $context)
    {
        if ($argumentName === 'plugin') {
            $repository = $this->getContainer()->get(ModelManager::class)->getRepository(Plugin::class);
            $queryBuilder = $repository->createQueryBuilder('plugin');
            $result = $queryBuilder->andWhere($queryBuilder->expr()->eq('plugin.capabilityEnable', 'true'))
                ->andWhere($queryBuilder->expr()->neq('plugin.active', 'true'))
                ->andWhere($queryBuilder->expr()->isNotNull('plugin.installed'))
                ->select(['plugin.name'])
                ->getQuery()
                ->getArrayResult();

            return array_column($result, 'name');
        }

        return [];
    }

    
return [];
    }

    /** * {@inheritdoc} */
    public function completeArgumentValues($argumentName, CompletionContext $context)
    {
        if ($argumentName === 'plugin') {
            $repository = $this->getContainer()->get(ModelManager::class)->getRepository(Plugin::class);
            $queryBuilder = $repository->createQueryBuilder('plugin');
            $result = $queryBuilder->andWhere($queryBuilder->expr()->eq('plugin.capabilityInstall', 'true'))
                ->andWhere($queryBuilder->expr()->isNull('plugin.installed'))
                ->select(['plugin.name'])
                ->getQuery()
                ->getArrayResult();

            return array_column($result, 'name');
        }

        return [];
    }

    

        }

        return $this->createSubCrawler($nodes);
    }

    /** * Returns the first node of the current selection. */
    public function first()static
    {
        return $this->eq(0);
    }

    /** * Returns the last node of the current selection. */
    public function last()static
    {
        return $this->eq(\count($this->nodes) - 1);
    }

    /** * Returns the siblings nodes of the current selection. * * @throws \InvalidArgumentException When current node is empty */

        return " if (($condition),($expression1),($expression2)) ";
    }

    private function addSorting(ProductNameSorting $sorting, QueryBuilder $query, ShopContextInterface $context): void
    {
        $query->leftJoin(
            self::PRODUCT,
            's_articles_translations',
            self::TRANSLATION,
            $query->expr()->andX(
                $query->expr()->eq(self::TRANSLATION . '.articleID', self::PRODUCT . '.id'),
                $query->expr()->eq(self::TRANSLATION . '.languageID', $context->getShop()->getId()),
                $query->expr()->isNotNull(self::TRANSLATION_NAME),
                $query->expr()->neq(self::TRANSLATION_NAME, $query->expr()->literal(''))
            )
        );

        $query->addOrderBy(
            self::exprIf(
                $query->expr()->isNull(self::TRANSLATION_NAME),
                self::PRODUCT . '.name',
                self::TRANSLATION_NAME
            ),
return [];
    }

    /** * {@inheritdoc} */
    public function completeArgumentValues($argumentName, CompletionContext $context)
    {
        if ($argumentName === 'plugin') {
            $repository = $this->getContainer()->get(ModelManager::class)->getRepository(Plugin::class);
            $queryBuilder = $repository->createQueryBuilder('plugin');
            $result = $queryBuilder->andWhere($queryBuilder->expr()->eq('plugin.capabilityEnable', 'true'))
                ->andWhere($queryBuilder->expr()->neq('plugin.active', 'true'))
                ->andWhere($queryBuilder->expr()->isNull('plugin.installed'))
                ->andWhere($queryBuilder->expr()->neq('plugin.source', ':source'))
                ->setParameter('source', 'Default')
                ->select(['plugin.name'])
                ->getQuery()
                ->getArrayResult();

            return array_column($result, 'name');
        }

        
return [];
    }

    /** * {@inheritdoc} */
    public function completeArgumentValues($argumentName, CompletionContext $context)
    {
        if ($argumentName === 'plugin') {
            $repository = $this->getContainer()->get(ModelManager::class)->getRepository(Plugin::class);
            $queryBuilder = $repository->createQueryBuilder('plugin');
            $result = $queryBuilder->andWhere($queryBuilder->expr()->eq('plugin.capabilityEnable', 'true'))
                ->andWhere($queryBuilder->expr()->isNotNull('plugin.installed'))
                ->select(['plugin.name'])
                ->getQuery()
                ->getArrayResult();

            return array_column($result, 'name');
        }

        return [];
    }

    
->execute()
            ->fetchAll(PDO::FETCH_COLUMN);

        $sites = [];
        foreach ($keys as $key) {
            $builder = $this->connection->createQueryBuilder();
            $current = $builder->from('s_cms_static', 'sites')
                ->select('*')
                ->where('sites.active = 1')
                ->andWhere(
                    $builder->expr()->orX(
                        $builder->expr()->eq('sites.grouping', ':g1'),   // = bottom                         $builder->expr()->like('sites.grouping', ':g2'), // like 'bottom|%                         $builder->expr()->like('sites.grouping', ':g3'), // like '|bottom                         $builder->expr()->like('sites.grouping', ':g4')  // like '|bottom|                     )
                )
                ->andWhere(
                    $builder->expr()->orX(
                        $builder->expr()->like('sites.shop_ids', ':shopId'),
                        $builder->expr()->isNull('sites.shop_ids')
                    )
                )
                
'coreConfigElements',
                's_core_config_forms',
                'coreConfigForms',
                'coreConfigElements.form_id = coreConfigForms.id'
            )
            ->innerJoin(
                'coreConfigForms',
                's_core_plugins',
                'corePlugins',
                'coreConfigForms.plugin_id = corePlugins.id'
            )
            ->andWhere($builder->expr()->eq('corePlugins.name', ':' . $pluginNameKey))
            ->setParameter($pluginNameKey$pluginName)
            ->select([
                'coreConfigElements.name',
                'coreConfigElements.value',
            ])
            ->execute()
            ->fetchAll(PDO::FETCH_KEY_PAIR)
        ;

        return AbstractShopConfigurationLayer::unserializeArray($values);
    }

    
/** * True, if the provided pattern is already used in another promotion. */
    private function isCodePatternAlreadyUsed(string $pattern, ?string $promotionId): bool
    {
        $qb = $this->connection->createQueryBuilder();

        $query = $qb
            ->select('id')
            ->from('promotion')
            ->where($qb->expr()->eq('individual_code_pattern', ':pattern'))
            ->setParameter('pattern', $pattern);

        $promotions = $query->executeQuery()->fetchFirstColumn();

        /** @var string $id */
        foreach ($promotions as $id) {
            // if we have a promotion id to verify             // and a promotion with another id exists, then return that is used             if ($promotionId !== null && $id !== $promotionId) {
                return true;
            }
        }
Home | Imprint | This part of the site doesn't use cookies.