0

i'm using the searchplugin from cakeDC (https://github.com/CakeDC/search) with cakePHP 2.3.0. That Plugin works fine. I had a little error in the index-action like this. Thanks for that.

Indirect modification of overloaded property AtlasController::$paginate has no effect [APP\Controller\AtlasController.php, line 47]

My Index-action

public function index() {
    $this->Prg->commonProcess();
    $this->paginate['conditions'] = $this->Atla->parseCriteria($this->passedArgs);
    $this->Atla->recursive = 0;
    $this->set('atlas', $this->paginate());
    $this->set('_serialize',array('atlas'));
}

The question is, how can i solve it? So i found out a way thats so simple and easy.

amarradi
  • 109
  • 3
  • 16

2 Answers2

0

So this is the solution, that runs on my implementation.

I change the paginate()-call from.

$this->set('atlas', $this->paginate());

to the new paginate()-call.

this->set('atlas', $this->paginate($this->Atla->parseCriteria($this->passedArgs)));

Here the new index-action.

public function index() {
    $this->Prg->commonProcess();
    $this->Atla->recursive = 0;
    $this->set('atlas', $this->paginate($this->Atla->parseCriteria($this->passedArgs)));
    $this->set('_serialize',array('atlas'));
}
amarradi
  • 109
  • 3
  • 16
0

I believe the reason why the code did not work out of the box is the ['options'] key. Remove the key from $this->paginate['options'] and add the model as an argument for paginate in
$this->set() and the pagination should work as expected. See the modified code example below.

public function index() {
    $this->Prg->commonProcess();
    $this->paginate = $this->Atla->parseCriteria($this->passedArgs);
    $this->Atla->recursive = 0;
    $this->set('atlas', $this->paginate('Atla'));
    $this->set('_serialize',array('atlas'));
}