Search code examples
cakephpcakedc

CakeDC search plugin - check if flag is set


I'm using the cakeDC search plugin in my cake app (2.2). As part of a basic search form I want to ensure only live records are returned (live being a flag in the database - a tinyint, 0 for deleted, 1 for live).

I've tried doing this in my controller:

$isLive = array('live' => '1');
$this->passedArgs = set::merge($this->passedArgs, $isLive);

But it didnt work...

I found this question but the answer didnt really help. Could anyone tell me where I'm going wrong?

Thanks in advance.


Solution

  • Solved, I missed the filterArgs in the model:

    public $filterArgs = array(
        'username' => array('type' => 'like'),
        'company' => array('type' => 'like'),
        'live' => array('type' => 'value')
    );
    

    Hopefully this will help someone