src/Backend/Modules/Commerce/Domain/Product/ProductRepository.php
/**
     * Filter the products and count the result.
     */
Filter the products and count the result.
Filter the products and count the result .
public function filterProductsCount(array $filters, Category $category): int
    {
        $sql = 'SELECT count(p.id) as total_products FROM commerce_products p WHERE p.categoryId = :category AND p.hidden = :hidden';
        $parameters = [
            'category' => $category->getId(),
            'hidden' => false,
        ];
        $this->buildFilterQuery($sql, $parameters, $filters);
        $connection = $this->getEntityManager()->getConnection();
        $stmt = $connection->prepare($sql);
        $stmt->execute($parameters);
        return (int) $stmt->fetchColumn(0);
    }
public function filterProductsCount ( array $ filters , Category $ category ) : int { $ sql = 'SELECT count(p.id) as total_products FROM commerce_products p WHERE p.categoryId = :category AND p.hidden = :hidden' ; $ parameters = [ 'category' => $ category -> getId ( ) , 'hidden' => false , ] ; $ this -> buildFilterQuery ( $ sql , $ parameters , $ filters ) ; $ connection = $ this -> getEntityManager ( ) -> getConnection ( ) ; $ stmt = $ connection -> prepare ( $ sql ) ; $ stmt -> execute ( $ parameters ) ; return ( int ) $ stmt -> fetchColumn ( 0 ) ; }
Filter the products and count the result.
Filter the products and count the result .