Harman
Harman

Reputation: 1753

after bind model my conditions is not working Cakephp

I have bind model after I want to apply condition something like that cakephp 1.3

$this->Question->bindModel(
        array(
            'hasOne'=>array(
                'QaRegion'=>array(
                    'className' => 'QaRegion',
                    'foreignKey'=>'region_id',
                    'conditions'=>array(
                            'QaRegion.region_id' => array(5,2,7) 
                        )
                )
            )
        )
    );
    echo '<pre>';

    $questionData = $this->Question->find('first', array('conditions'=>array('QaRegion.id !='=>'')));
    print_r($questionData); die('s');

I have bind Question model to QaRegion. Now I want to implement in query where QaRegion.id != null and it's not working. Please help me.

Upvotes: 0

Views: 373

Answers (1)

Jaskaran singh Rajal
Jaskaran singh Rajal

Reputation: 2330

change in your query

 $questionData = $this->Question->find('first', array('conditions'=>array('QaRegion.id NOT'=>Null),'Order' => array('Question.id DESC')));

Upvotes: 7

Related Questions