Copied!

CatalogResolverInterface

CatalogResolverInterface.php : 29

The catalog resolver is used to determine the catalog that should be used for a given user.

The following example demonstrates how to list products available for the current user using the catalog resolver:

$catalog = $catalogResolver->resolveCatalog();
if ($catalog !== null) {
   $products = $productService->findProducts($catalog->getQuery());
   // ...
}

Logic can be customized by listening to the CatalogResolveEvent event.

Methods

publicresolveCatalog()

CatalogResolverInterface.php : 36

Retrieves the catalog for the given user.

public resolveCatalog([User|null $user = null ]) : CatalogInterface|null

Parameters

Name Type Default value Description
$user User|null null

The user for which to resolve the catalog. If null, the current user is used.

Return values

CatalogInterface|null