generatePartialFacets example



        foreach ($criteria->getUserConditions() as $criteriaPart) {
            $handler = $this->handlerRegistry->getHandler($criteriaPart);

            // Trigger error when new interface isn't implemented             if (!$handler instanceof PartialConditionHandlerInterface) {
                trigger_error(sprintf('Condition handler "%s" doesn\'t support new filter mode. Class has to implement "%s".', \get_class($handler), PartialConditionHandlerInterface::class), E_USER_DEPRECATED);
            }

            // Filter mode active and handler doesn't supports the filter mode?             if (!$handler instanceof PartialConditionHandlerInterface && $criteria->generatePartialFacets()) {
                throw new Exception(sprintf('New filter mode activated, handler class %s doesn\'t support this mode', \get_class($handler)));
            }

            // Filter mode active and handler supports new filter mode?             if ($handler instanceof PartialConditionHandlerInterface && $criteria->generatePartialFacets()) {
                $handler->handleFilter($criteriaPart$criteria$search$context);
                continue;
            }

            // Old filter mode activated and implements new interface?             if ($handler instanceof PartialConditionHandlerInterface) {
                

    private function createFacets(SearchBundle\Criteria $criteria, ShopContextInterface $context)
    {
        if (\count($criteria->getFacets()) === 0) {
            return [];
        }

        $facets = [];

        $clone = clone $criteria;

        if (!$criteria->generatePartialFacets()) {
            $clone->resetConditions();
            $clone->resetSorting();
        }

        foreach ($criteria->getFacets() as $facet) {
            $handler = $this->getFacetHandler($facet);

            if ($criteria->generatePartialFacets() && !$handler instanceof PartialFacetHandlerInterface) {
                throw new RuntimeException(sprintf("New filter mode activated, handler class %s doesn't support this mode", \get_class($handler)));
            }

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