/**
  * {@inheritDoc}
  */
 protected function _applyFilter(QueryBuilderInterface $queryBuilder)
 {
     if (empty($this->_value)) {
         return;
     }
     $queryBuilder->leftJoin('page_tag', 'page_tag.page_id = page.page_id')->where('page_tag.tag_name IN (?js)', [$this->_value]);
 }
 /**
  * {@inheritDoc}
  */
 protected function _applyFilter(QueryBuilderInterface $queryBuilder)
 {
     if (empty($this->_value)) {
         return;
     }
     $units = $this->_unitLoader->getSaleUnits();
     array_walk($units, function (&$unit) {
         $unit = $unit->id;
     });
     $queryBuilder->join('product_page_unit_record', 'product_page_unit_record.page_id = page.page_id')->where('product_page_unit_record.unit_id IN (?ji)', [$units]);
 }
 /**
  * Will not apply the filter if both values are null.
  * If the filter is applied and the content field is not set on the page, it will not show up in the results
  *
  * {@inheritDoc}
  */
 protected function _applyFilter(QueryBuilderInterface $queryBuilder)
 {
     $joinedContent = false;
     foreach ($this->_value as $key => $value) {
         if (false === $joinedContent && null !== $value) {
             $queryBuilder->leftJoin($this->_getContentAlias(), $this->_getJoinStatement(), 'page_content')->where($this->_getContentAlias() . '.field_name = ?s', [$this->_field]);
             $joinedContent = true;
         }
         if (null !== $value) {
             if ($key === RangeFilterForm::MIN) {
                 $queryBuilder->where($this->_castSQLValue($this->_getContentAlias() . '.value_string') . ' >= ' . $this->_castSQLValue('?s'), [$this->_value[RangeFilterForm::MIN]]);
             } elseif ($key === RangeFilterForm::MAX) {
                 $queryBuilder->where($this->_castSQLValue($this->_getContentAlias() . '.value_string') . ' <= ' . $this->_castSQLValue('?s'), [$this->_value[RangeFilterForm::MAX]]);
             } else {
                 throw new \LogicException('Key `' . $key . '` should not exist on value!');
             }
         }
     }
 }
 /**
  * Run the query set in the query builder
  *
  * @throws \LogicException            Throws exception if no query builder is set on the loader
  *
  * @return \Message\Cog\DB\Result     Returns database result from query
  */
 private function _runQuery()
 {
     if (null === $this->_queryBuilder) {
         throw new \LogicException('Query builder not set, run _buildQuery() first!');
     }
     if (null !== $this->_pagination) {
         $this->_pagination->setCountQuery($this->_getCountQuery());
         $this->_pagination->setQuery($this->_queryBuilder->getQueryString());
         $result = $this->_pagination->getCurrentPageResults();
     } else {
         $result = $this->_queryBuilder->getQuery()->run();
     }
     $this->_queryBuilder = null;
     return $result;
 }
 /**
  * {@inheritDoc}
  */
 protected function _applyFilter(QueryBuilderInterface $queryBuilder)
 {
     $queryBuilder->leftJoin($this->_getContentAlias(), $this->_getJoinStatement(), 'page_content')->where($this->_getContentAlias() . '.field_name = ?s', [$this->_field])->where($this->_getContentAlias() . '.value_string IN (?js)', [$this->_value]);
 }