createManufacturer example

public static function whenToUseNullSafeOperatorProvider()
    {
        yield 'Dont used for simple equals' => [new EqualsFilter('product.id', Uuid::randomHex()), false];
        yield 'Used for negated comparison' => [new NandFilter([new EqualsFilter('product.id', Uuid::randomHex())]), true];
        yield 'Used for negated null comparison' => [new NandFilter([new EqualsFilter('product.id', null)]), true];
        yield 'Used in nested negated comparison' => [new AndFilter([new NandFilter([new EqualsFilter('product.id', Uuid::randomHex())])]), true];
        yield 'Used for null comparison' => [new EqualsFilter('product.id', null), true];
    }

    public function testContainsFilterFindUnderscore(): void
    {
        $targetId = $this->createManufacturer(['link' => 'target_to_find']);
        $errournousId = $this->createManufacturer(['link' => 'target to find']);
        $criteria = (new Criteria())->addFilter(new ContainsFilter('link', 'target_to_find'));
        $foundIds = $this->manufacturerRepository->searchIds($criteria, Context::createDefaultContext());

        static::assertContains($targetId$foundIds->getIds());
        static::assertNotContains($errournousId$foundIds->getIds());
    }

    public function testContainsFilterFindPercentageSign(): void
    {
        $targetId = $this->createManufacturer(['link' => 'target%find']);
        
$this->manufacturerRepository = $this->getContainer()->get('product_manufacturer.repository');
        $this->connection = $this->getContainer()->get(Connection::class);
        $this->url = '/api';
    }

    /** * TOTAL-COUNT-MODE */
    public function testListTotalCountMode(): void
    {
        for ($i = 0; $i < 35; ++$i) {
            $this->createManufacturer(['link' => 'test']);
        }

        // no count, equals to fetched entities         $this->getBrowser()->request('GET', $this->url . '/product-manufacturer', ['total-count-mode' => Criteria::TOTAL_COUNT_MODE_NONE, 'filter' => ['product_manufacturer.link' => 'test'], 'limit' => 5]);
        static::assertSame(200, $this->getBrowser()->getResponse()->getStatusCode()$this->getBrowser()->getResponse()->getContent());
        $content = json_decode($this->getBrowser()->getResponse()->getContent(), true, 512, \JSON_THROW_ON_ERROR);

        static::assertEquals(5, $content['meta']['total']print_r($content, true));

        // calculates all matching rows         $this->getBrowser()->request('GET', $this->url . '/product-manufacturer', ['total-count-mode' => Criteria::TOTAL_COUNT_MODE_EXACT, 'filter' => ['product_manufacturer.link' => 'test'], 'limit' => 5]);
        

    private array $languages = [
        'en-GB', 'de-DE',
    ];

    public function testTranslationsAreAllSelectable(): void
    {
        $enContext = Context::createDefaultContext();
        $manufacturerId = Uuid::randomHex();
        $manufacturerRepository = $this->getContainer()->get('product_manufacturer.repository');

        $this->createManufacturer($manufacturerRepository$manufacturerId$enContext);

        $versionId = $manufacturerRepository->createVersion($manufacturerId$enContext);
        $enVersionContext = $enContext->createWithVersionId($versionId);
        $deContext = $this->createDeContext($enContext);
        $deVersionContext = $deContext->createWithVersionId($versionId);

        $manufacturerRepository->update([[
            'id' => $manufacturerId,
            'name' => 'version-en-GB',
        ]]$enVersionContext);

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