I want to make such a request using cakephp:
WHERE text LIKE '%keyword%' AND ( (text LIKE '%something%') OR (text LIKE '%something%') OR (...) ) AND ( (text LIKE '%other%') OR (text LIKE '%other%') OR (...) ) NOT ( (text LIKE '%dont include%') OR (text LIKE '%dont include%') OR (...) )
this is my code for $ conditions:
$conditions = array ( 'Tweet.text LIKE' => '%keyword%', 'AND' => array( array( 'OR' => array( // topic array('Tweet.text LIKE' => '%something%'), array('Tweet.text LIKE' => '%something%') ) ), array( 'OR' => array( // sentiment array('Tweet.text LIKE' => '%other%'), array('Tweet.text LIKE' => '%other%') ) ) ), 'NOT' => array( array('Tweet.text LIKE' => '%dont include%'), array('Tweet.text LIKE' => '%dont include%') ) );
I show the result using the Debugger :: dump () method, and the result simply uses the last OR condition, not both the OR conditions:
array( 'Tweet.text LIKE' => '%keyword%', 'OR' => array( (int) 0 => array( 'Tweet.text LIKE' => '%other%' ), (int) 1 => array( 'Tweet.text LIKE' => '%other%' ) ), 'NOT' => array( (int) 0 => array( 'Tweet.text LIKE' => '%dont include%' ), (int) 1 => array( 'Tweet.text LIKE' => '%dont include%' ) ) )
My question is: how can I make the request use the "OR" condition?
Pls reply as soon as possible .. Thanks in advance :)
source share