getSalesChannelRepository example

foreach ($inserts as &$insert) {
            foreach ($insert[2] ?? [] as $key => $language) {
                if ($language === 'de-DE') {
                    $insert[2][$key] = $deDeLanguageId;
                }
            }

            $insert = $this->getSalesChannelData(...$insert);
        }

        try {
            $this->getSalesChannelRepository()
                ->create($inserts, Context::createDefaultContext());
        } catch (WriteException $exception) {
            // nth         }

        if (!$invalids) {
            static::assertNull($exception);

            $this->getSalesChannelRepository()->delete([
                $valids,
            ], Context::createDefaultContext());

            
public function testItThrowsExceptionWhenSalesChannelRepositoryWasNotFoundByEntityName(): void
    {
        $registry = new SalesChannelDefinitionInstanceRegistry(
            'sales_channel_definition.',
            new Container(),
            [],
            []
        );

        $this->expectException(SalesChannelRepositoryNotFoundException::class);
        $registry->getSalesChannelRepository('fooBar');
    }
}

    public function search(string $entityName, array $criteria): EntitySearchResult
    {
        $criteriaObject = $this->prepareCriteria($entityName$criteria);

        return $this->registry->getSalesChannelRepository($entityName)->search($criteriaObject$this->context);
    }

    /** * The `ids()` method allows you to search for the Ids of Entities that match a given criteria. * * @param string $entityName The name of the Entity you want to search for, e.g. `product` or `media`. * @param array<string, mixed> $criteria The criteria used for your search. * * @return IdSearchResult A `IdSearchResult` including all entity-ids that matched your criteria. * * @example store-search-ids/script.twig Get the Ids of products with the given ProductNumber. */
Home | Imprint | This part of the site doesn't use cookies.