Ejemplo n.º 1
0
 public function __construct(SelectInterface $query, Connection $connection)
 {
     parent::__construct($query, $connection);
     // Add pager tag. Do this here to ensure that it is always added before
     // preExecute() is called.
     $this->addTag('pager');
 }
Ejemplo n.º 2
0
 public function __construct(SelectInterface $query, Connection $connection)
 {
     parent::__construct($query, $connection);
     // Add convenience tag to mark that this is an extended query. We have to
     // do this in the constructor to ensure that it is set before preExecute()
     // gets called.
     $this->addTag('tablesort');
 }
Ejemplo n.º 3
0
 /**
  * Adds the configured rankings to the search query.
  *
  * @param $query
  *   A query object that has been extended with the Search DB Extender.
  */
 protected function addNodeRankings(SelectExtender $query)
 {
     if ($ranking = $this->getRankings()) {
         $tables =& $query->getTables();
         foreach ($ranking as $rank => $values) {
             if (isset($this->configuration['rankings'][$rank]) && !empty($this->configuration['rankings'][$rank])) {
                 $node_rank = $this->configuration['rankings'][$rank];
                 // If the table defined in the ranking isn't already joined, then add it.
                 if (isset($values['join']) && !isset($tables[$values['join']['alias']])) {
                     $query->addJoin($values['join']['type'], $values['join']['table'], $values['join']['alias'], $values['join']['on']);
                 }
                 $arguments = isset($values['arguments']) ? $values['arguments'] : array();
                 $query->addScore($values['score'], $arguments, $node_rank);
             }
         }
     }
 }
Ejemplo n.º 4
0
 /**
  * {@inhertidoc}
  */
 public function preExecute(SelectInterface $query = NULL)
 {
     if (!$this->executedPrepare) {
         $this->prepareAndNormalize();
     }
     if (!$this->normalize) {
         return FALSE;
     }
     return parent::preExecute($query);
 }