protected function loadCollection(BlockInterface $block)
    {
        $properties = $block->getProperties();

        $conditions = (isset($properties['conditions'])) ? $properties['conditions'] : '[]';
        $conditions = $this->expressionEngine->deserialize($conditions);

        if (empty($conditions)) {
            return;
        }

        $site = $this->siteManager->getSite();

        $qb = $this->expressionEngine->toQueryBuilder($conditions, $this->contentManager->getClass());
        $qb->andWhere('a.publishAt < :now OR a.publishAt IS NULL')
            ->andWhere('a.active = :active')
            ->andWhere('a.layout = :layout');

        if ($site == null) {
            $qb->andWhere('a.site IS NULL');
        } else {
            $qb->andWhere('a.site = :site')
               ->setParameter('site', $site);
        }

        $qb->setParameter('active', true)
            ->setParameter('layout', false)
            ->setParameter('now', new \DateTime());

        if (isset($properties['order_by'])) {
            $direction = (isset($properties['order_direction'])) ? $properties['order_direction'] : 'ASC';

            $qb->orderBy('a.'.$properties['order_by'], $direction);
        }

        $limit = (isset($properties['limit'])) ? $properties['limit'] : 10;
        $qb->setMaxResults($limit);

        $collection = $qb->getQuery()->getResult();

        if ($collection) {
            $block->setCollection($collection);
        }
    }
protected function loadCollection(BlockInterface $block)
    {
        $properties = $block->getProperties();

        $conditions = (isset($properties['conditions'])) ? $properties['conditions'] : '[]';
        $conditions = $this->expressionEngine->deserialize($conditions);

        if (empty($conditions)) {
            return;
        }

        $site = $this->siteManager->getSite();

        $qb = $this->expressionEngine->toQueryBuilder($conditions, $this->contentManager->getClass());
        $qb->andWhere('a.publishAt < :now OR a.publishAt IS NULL')
            ->andWhere('a.active = :active')
            ->andWhere('a.layout = :layout');

        if ($site == null) {
            $qb->andWhere('a.site IS NULL');
        } else {
            $qb->andWhere('a.site = :site')
               ->setParameter('site', $site);
        }

        $qb->setParameter('active', true)
            ->setParameter('layout', false)
            ->setParameter('now', new \DateTime());

        if (isset($properties['order_by'])) {
            $direction = (isset($properties['order_direction'])) ? $properties['order_direction'] : 'ASC';

            $qb->orderBy('a.'.$properties['order_by'], $direction);
        }

        $limit = (isset($properties['limit'])) ? $properties['limit'] : 10;
        $qb->setMaxResults($limit);

        $collection = $qb->getQuery()->getResult();

        if ($collection) {
            $block->setCollection($collection);
        }
    }
protected function loadCollection ( BlockInterface $ block ) { $ properties = $ block -> getProperties ( ) ; $ conditions = ( isset ( $ properties [ 'conditions' ] ) ) ? $ properties [ 'conditions' ] : '[]' ; $ conditions = $ this -> expressionEngine -> deserialize ( $ conditions ) ; if ( empty ( $ conditions ) ) { return ; } $ site = $ this -> siteManager -> getSite ( ) ; $ qb = $ this -> expressionEngine -> toQueryBuilder ( $ conditions , $ this -> contentManager -> getClass ( ) ) ; $ qb -> andWhere ( 'a.publishAt < :now OR a.publishAt IS NULL' ) -> andWhere ( 'a.active = :active' ) -> andWhere ( 'a.layout = :layout' ) ; if ( $ site == null ) { $ qb -> andWhere ( 'a.site IS NULL' ) ; } else { $ qb -> andWhere ( 'a.site = :site' ) -> setParameter ( 'site' , $ site ) ; } $ qb -> setParameter ( 'active' , true ) -> setParameter ( 'layout' , false ) -> setParameter ( 'now' , new \ DateTime ( ) ) ; if ( isset ( $ properties [ 'order_by' ] ) ) { $ direction = ( isset ( $ properties [ 'order_direction' ] ) ) ? $ properties [ 'order_direction' ] : 'ASC' ; $ qb -> orderBy ( 'a.' . $ properties [ 'order_by' ] , $ direction ) ; } $ limit = ( isset ( $ properties [ 'limit' ] ) ) ? $ properties [ 'limit' ] : 10 ; $ qb -> setMaxResults ( $ limit ) ; $ collection = $ qb -> getQuery ( ) -> getResult ( ) ; if ( $ collection ) { $ block -> setCollection ( $ collection ) ; } }
Load the collection if any conditions are defined.

@param BlockInterface $block
Load the collection if any conditions are defined .