Пример #1
0
 /**
  * @param Condition $condition
  * @param \Nette\Database\Table\Selection $selection
  */
 protected function makeWhere(Condition $condition, \Nette\Database\Table\Selection $selection = NULL)
 {
     $selection = $selection === NULL ? $this->selection : $selection;
     if ($condition->callback) {
         callback($condition->callback)->invokeArgs(array($condition->value, $selection));
     } else {
         call_user_func_array(array($selection, 'where'), $condition->__toArray());
     }
 }
Пример #2
0
 /**
  * @param \Grido\Components\Filters\Condition $condition
  * @param \DibiFluent $fluent
  */
 protected function makeWhere(\Grido\Components\Filters\Condition $condition, \DibiFluent $fluent = NULL)
 {
     $fluent = $fluent === NULL ? $this->fluent : $fluent;
     if ($condition->callback) {
         callback($condition->callback)->invokeArgs(array($condition->value, $fluent));
     } else {
         call_user_func_array(array($fluent, 'where'), $condition->__toArray('[', ']'));
     }
 }
Пример #3
0
 /**
  * @param Condition $condition
  */
 protected function makeWhere(Condition $condition)
 {
     if ($condition->callback) {
         //callback($condition->callback)->invokeArgs(array($condition->value, $selection));
     } else {
         $condarray = $condition->__toArray();
         $this->filterValues[$condarray[0]] = $condarray[1];
         //call_user_func_array(array($selection, 'where'), $condition->__toArray());
     }
 }
Пример #4
0
 /**
  * @param Condition $condition
  * @param \Doctrine\ORM\QueryBuilder $qb
  */
 protected function makeWhere(Condition $condition, \Doctrine\ORM\QueryBuilder $qb = NULL)
 {
     $qb = $qb === NULL ? $this->qb : $qb;
     if ($condition->callback) {
         return callback($condition->callback)->invokeArgs(array($condition->value, $qb));
     }
     $columns = $condition->column;
     foreach ($columns as $key => $column) {
         if (!Condition::isOperator($column)) {
             $columns[$key] = isset($this->filterMapping[$column]) ? $this->filterMapping[$column] : (Strings::contains($column, ".") ? $column : current($this->qb->getRootAliases()) . '.' . $column);
         }
     }
     $condition->setColumn($columns);
     list($where) = $condition->__toArray(NULL, NULL, FALSE);
     $rand = $this->getRand();
     $where = preg_replace_callback('/\\?/', function () use($rand) {
         static $i = -1;
         $i++;
         return ":{$rand}{$i}";
     }, $where);
     $qb->andWhere($where);
     foreach ($condition->getValueForColumn() as $i => $val) {
         $qb->setParameter("{$rand}{$i}", $val);
     }
 }