public function getHomePurchasables(
        $limit = 0,
        $useStock = true
    ) {
        $queryBuilder = $this->createQueryBuilder('p');

        $this->addPerformanceJoinsToQueryBuilder($queryBuilder);
        $this->addStockPropertiesToQueryBuilder(
            $queryBuilder,
            $useStock
        );

        $query = $queryBuilder
            ->andWhere('p.enabled = :enabled')
            ->andWhere('p.showInHome = :showInHome')
            ->setParameter('enabled', true)
            ->setParameter('showInHome', true)
            ->orderBy('p.updatedAt', 'DESC');

        if ($limit > 0) {
            $query->setMaxResults($limit);
        }

        return $query
            ->getQuery()
            ->getResult();
    }
public function getHomePurchasables(
        $limit = 0,
        $useStock = true
    ) {
        $queryBuilder = $this->createQueryBuilder('p');

        $this->addPerformanceJoinsToQueryBuilder($queryBuilder);
        $this->addStockPropertiesToQueryBuilder(
            $queryBuilder,
            $useStock
        );

        $query = $queryBuilder
            ->andWhere('p.enabled = :enabled')
            ->andWhere('p.showInHome = :showInHome')
            ->setParameter('enabled', true)
            ->setParameter('showInHome', true)
            ->orderBy('p.updatedAt', 'DESC');

        if ($limit > 0) {
            $query->setMaxResults($limit);
        }

        return $query
            ->getQuery()
            ->getResult();
    }
public function getHomePurchasables ( $ limit = 0 , $ useStock = true ) { $ queryBuilder = $ this -> createQueryBuilder ( 'p' ) ; $ this -> addPerformanceJoinsToQueryBuilder ( $ queryBuilder ) ; $ this -> addStockPropertiesToQueryBuilder ( $ queryBuilder , $ useStock ) ; $ query = $ queryBuilder -> andWhere ( 'p.enabled = :enabled' ) -> andWhere ( 'p.showInHome = :showInHome' ) -> setParameter ( 'enabled' , true ) -> setParameter ( 'showInHome' , true ) -> orderBy ( 'p.updatedAt' , 'DESC' ) ; if ( $ limit > 0 ) { $ query -> setMaxResults ( $ limit ) ; } return $ query -> getQuery ( ) -> getResult ( ) ; }
Get purchasables that can be shown in Home.

@param int  $limit    Purchasable limit. By default, this value is 0
@param bool $useStock Use stock

@return array Set of Purchasables, result of the query
Get purchasables that can be shown in Home .