コード例 #1
0
ファイル: SearchMapper.php プロジェクト: bono-cms/Search
 /**
  * Appends query parts from registered mappers
  * 
  * @param \Krystal\Db\Sql\QueryBuilderInterface $db Query builder
  * @return void
  */
 private function appendFromMappers(QueryBuilderInterface $qb)
 {
     // Amount of registered mappers we have
     $amount = count($this->mappers);
     // Iteration counter
     $i = 0;
     foreach ($this->mappers as $mapper) {
         $qb->openBracket();
         $mapper->appendQuery($qb, self::PARAM_QUERY_PLACEHOLDER);
         $qb->closeBracket();
         ++$i;
         // Comparing iteration against number of mappers, tells whether this iteration is last
         $last = $i == $amount;
         // If we have more that one mapper, then we need to union results
         // And also, we should never append UNION in last iteration
         if ($amount > 1 && !$last) {
             $qb->union();
         }
     }
 }
コード例 #2
0
ファイル: SearchMapper.php プロジェクト: bono-cms/Shop
 /**
  * {@inheritDoc}
  */
 public function appendQuery(QueryBuilderInterface $queryBuilder, $placeholder)
 {
     $queryBuilder->select($this->getWithDefaults(array('description' => 'content')))->from(ProductMapper::getTableName())->whereEquals('lang_id', "'{$this->getLangId()}'")->andWhereEquals('published', '1')->andWhereLike('title', $placeholder)->orWhereLike('description', $placeholder);
 }
コード例 #3
0
ファイル: SearchMapper.php プロジェクト: bono-cms/Pages
 /**
  * {@inheritDoc}
  */
 public function appendQuery(QueryBuilderInterface $queryBuilder, $placeholder)
 {
     $queryBuilder->select($this->getWithDefaults(array('content')))->from(PageMapper::getTableName())->whereEquals('seo', '1')->andWhereEquals('lang_id', "'{$this->getLangId()}'")->rawAnd()->openBracket()->like('title', $placeholder)->rawOr()->like('content', $placeholder)->closeBracket();
 }