getSortByField() public method

Returns the query builders sort by field.
public getSortByField ( ) : string
return string
コード例 #1
0
ファイル: Processor.php プロジェクト: vortextangent/Adldap2
 /**
  * Sorts LDAP search results.
  *
  * @param array $models
  *
  * @return array
  */
 private function processSort(array $models = [])
 {
     $collection = $this->newCollection($models);
     $sort = [$this->builder->getSortByField() => $this->builder->getSortByDirection()];
     $criteria = (new Criteria())->orderBy($sort);
     return $collection->matching($criteria)->toArray();
 }
コード例 #2
0
ファイル: Processor.php プロジェクト: adldap2/adldap2
 /**
  * Sorts LDAP search results.
  *
  * @param array $models
  *
  * @return Collection
  */
 protected function processSort(array $models = [])
 {
     $field = $this->builder->getSortByField();
     $flags = $this->builder->getSortByFlags();
     $direction = $this->builder->getSortByDirection();
     $desc = $direction === 'desc' ? true : false;
     return $this->newCollection($models)->sortBy(function (Model $model) use($field) {
         return $model->getAttribute($field, 0);
     }, $flags, $desc);
 }
コード例 #3
0
ファイル: Processor.php プロジェクト: gwjwin/Adldap2
 /**
  * Sorts LDAP search results.
  *
  * @param array $models
  *
  * @return Collection
  */
 protected function processSort(array $models = [])
 {
     $collection = $this->newCollection($models);
     $field = $this->builder->getSortByField();
     $direction = $this->builder->getSortByDirection();
     if ($direction === 'desc') {
         $sorted = $collection->sortByDesc($field);
     } else {
         $sorted = $collection->sortBy($field);
     }
     return $sorted;
 }