addToStack() public méthode

public addToStack ( $all )
$all
Exemple #1
0
 public function test_it_adds_to_stack()
 {
     $Framework = new \Devise\Support\Framework();
     $Framework->Session = m::mock('Mock\\Session');
     $Framework->Session->shouldReceive('get')->times(1)->andReturn([]);
     $Framework->Session->shouldReceive('put')->times(1);
     $Manager = new Manager($Framework);
     $Manager->addToStack([]);
 }
Exemple #2
0
 /**
  * Ads orderBy to the current query in builder
  *
  * @param  QueryBuilder    $query
  * @param  Model  $model
  * @return void
  */
 public function handleSorting(&$query, $model)
 {
     if ($this->Input->has('clearSort')) {
         $this->Manager->clearStack();
     }
     if ($this->Input->has('multisort')) {
         $this->Manager->setIsMulti(true);
     }
     $sortStack = $this->Manager->getStack();
     if ($this->Input->has('orderBy') || count($sortStack) > 0) {
         if (!$this->Input->has('multisort') && !$this->Manager->getIsMulti() && $this->Input->has('orderBy')) {
             $this->Manager->clearStack();
         }
         $this->Manager->addToStack($this->Input->all());
         $sortStack = $this->Manager->getStack();
         foreach ($sortStack as $sort) {
             $query = $this->appendSort($query, $model, $sort);
         }
     } else {
         if (count($this->defaultOrderBy) > 0) {
             $query = $this->sortByDefault($query, $model);
         }
     }
 }