public function orderByDescending($selector, $method = SORT_REGULAR) { if ($this->isConverted === false && is_string($selector) && isset($this->options['mapping'][$selector]) && $this->data instanceof Collection) { return new self($this->data->orderByDescending($this->options['mapping'][$selector], $method), $this->model, $this->repository, $this->options); } return parent::orderByDescending($selector, $method); }
/** * Return a new collection sorted by the given field in descending order. * * @param string $selector * @param int $method The sorting method, options are: SORT_REGULAR, SORT_NUMERIC, SORT_STRING or SORT_NATURAL * * @return Collection */ public function orderByDescending($selector, $method = SORT_REGULAR) { if ($this->data === null && $method == SORT_REGULAR && is_string($selector) && is_string($this->sql) === false && is_array($this->sql->orderBy) && $this->sql->limit === false && $this->sql->offset == 0) { $sql = clone $this->sql; \Sledgehammer\array_key_unshift($sql->orderBy, $selector, 'DESC'); return new self($sql, $this->dbLink); } return parent::orderByDescending($selector, $method); }