public function sort(array $sorting) { $this->statement->removeClause('ORDER BY'); list($column, $sort) = $sorting; $column = sprintf('[%s]', $column); $this->statement->orderBy($column, $sort); }
public function getData() { if ($this->filterState) { $this->filter($this->filterState); } if ($this->sortState) { $this->sort($this->sortState); } return $this->dataSource->fetchAll(); }
/** * @param DibiConnection */ public function __construct(DibiConnection $connection) { $this->connection = $connection; if (self::$normalizer === NULL) { self::$normalizer = new DibiHashMap(array(__CLASS__, '_formatClause')); } }
/** * @param Connection */ public function __construct(Connection $connection) { $this->connection = $connection; if (self::$normalizer === NULL) { self::$normalizer = new HashMap([__CLASS__, '_formatClause']); } }
/** * Constructs fluent object * * @param string $rowClass row class * @param Nette\DI\Container DI */ public function __construct($rowClass, Nette\DI\Container $context) { $this->rowClass = $rowClass; $this->context = $context; parent::__construct($this->context->getByType('DibiConnection')); }
/** * @param array $sorting */ public function sort(array $sorting) { foreach ($sorting as $column => $sort) { $this->fluent->orderBy("%n", $column, $sort); } }
private function addSearchCondition(DibiFluent $sql, SearchRequest $request) { if ($request->query == "" && $request->from == "") { // limit results to topics $sql->where("data.parent_id = 0"); } else { if ($request->query != "") { $sql->where("MATCH(data.message) AGAINST (%s IN BOOLEAN MODE)", $request->query); } if ($request->from != "") { $sql = $sql->where("data.from_name LIKE %~like~", $request->from); // protection of hidden names in closed/secret groups $sql = $sql->where("groups.closed = 0"); } } if (count($request->tags)) { $taggedPostsId = $this->getMatchedIdByTags($request->tags); $sql = $sql->where("data.id IN %in", $taggedPostsId); } if (count($request->groups)) { $sql->where("data.group_id IN %in", $request->groups); } }
public function setFilter(array $filter) { if ($filter) { $this->fluent->where("%and", $this->convertFilter($filter)); } }
/** * Vytvoří z DibiFluent pole entit. * @param \DibiFluent $datasource * @param int|null $limit * @param int|null $offset * @return IEntity[] */ public function createEntities(\DibiFluent $datasource, $limit = NULL, $offset = NULL) { $entities = array(); foreach ($datasource->fetchAll($offset, $limit) as $row) { $entities[] = $this->createEntity($row); } return $entities; }
public function appendTo(DibiFluent $query) { return $query->groupBy($this->column->getEscaped()); }