categories example

$parameters = array_merge($defaults$parameters);

        $this->manufacturerRepository->create([$parameters], Context::createDefaultContext());

        return $id;
    }

    private function createProduct(): void
    {
        $products = [
            (new ProductBuilder($this->ids, 'product1-with-category', 10))
                ->categories(['category1', 'category2'])
                ->visibility()
                ->price(10)
                ->build(),
            (new ProductBuilder($this->ids, 'product2-with-category', 12))
                ->category('category2')
                ->visibility()
                ->price(20)
                ->build(),
            (new ProductBuilder($this->ids, 'product1-without-category', 14))
                ->visibility()
                ->price(30)
                

    private function prepareData(): array
    {
        $ids = new IdsCollection();

        $products = [];

        $name = 'product-with-category';
        $builder = new ProductBuilder($ids$name);
        $builder->price(200)
            ->categories(['cat1', 'cat2'])
            ->write($this->getContainer());
        /** @var array{id: string, children: array<int, array{id: string}>, categories: array<int, array{id: string, name:string}>} $product */
        $product = $builder->build();
        $products[$name] = $product['id'];
        /** @var list<string> $categories */
        $categories = \array_column($product['categories'], 'id');
        \sort($categories);

        $name = 'testable-product';
        $builder = new ProductBuilder($ids$name);
        $builder->price(100)
            
$this->connection->beginTransaction();

        parent::tearDown();
    }

    public function testPartialLoadingAddsImplicitAssociationToRequestedFields(): void
    {
        $ids = new IdsCollection();

        $product = (new ProductBuilder($ids, 'p1'))
            ->price(100)
            ->categories(['c1', 'c2'])
            ->visibility()
            ->manufacturer('m1');

        $this->getContainer()->get('product.repository')
            ->create([$product->build()], Context::createDefaultContext());

        $criteria = new Criteria();
        $criteria->addFields(['productNumber', 'name', 'categories.name']);

        $values = $this->getContainer()
            ->get('product.repository')
            
Home | Imprint | This part of the site doesn't use cookies.