0

I use the plugin cakedc search, but there is one thing I can not seem to find, I have a form with two fields, and I would add for example "online = 1" to my search in my controller, I trying:

    public function find() {
 $this->Prg->commonProcess();
 $array = array('type'=>'post', 'online'=>'1', 'created'=> '<= NOW()');
 $this->passedArgs = Set::merge($this->passedArgs, $array);

    $this->paginate = array(
      'conditions' => array($this->Post->parseCriteria($this->passedArgs)),
     );
    $this->set('posts', $this->paginate());

model:

    public $displayField = array('name', 'category_id');

    public $filterArgs = array(
                array('name' => 'name', 'type' => 'query', 'method' => 'filterName'),
                array('name' => 'category_id', 'type' => 'value')
           );
.....

debug($this->passedArgs):

array(
    'name' => 'mon',
    'category_id' => '2',
    'type' => 'post',
    'online' => '1',
    'created' => '<= NOW()'
)

but $array argument are not taken in my search Can anyone help? I am a beginner with cakephp, Thanks a lot !

pjfnew
  • 39
  • 4

1 Answers1

0

Instead of

'conditions' => array($this->Post->parseCriteria($this->passedArgs)),

try

'conditions' => $this->Post->parseCriteria($this->passedArgs),

I also recommend you to use DebugKit and to add the generated query to your question in the case it is still not working.

floriank
  • 25,546
  • 9
  • 42
  • 66