Of course I tasted. However, the working version was never found. Here's my attempt:
Variant 1:
$result = $this->Models->find()
->where(function ($exp) {
$notz = $exp->or_(['kw LIKE' => $word_7])
->eq('kw LIKE', $word_8)
->eq('kw LIKE', $word_9);
$and = $exp->and_(['kw LIKE' => $word_1])
->eq('kw LIKE', $word_2)
->eq('kw LIKE', $word_3);
$and2= $exp->and_(['kw LIKE' => $word_4])
->eq('kw LIKE', $word_5)
->eq('kw LIKE', $word_6);
return $exp->add($and)
->add($and2)
->not($notz);
});
Variant 2:
$result = $this->Models->find()
->where([
'OR' => [
['AND' => [['kw LIKE' => $word_1],['kw LIKE' => $word_2],['kw LIKE' => $word_3]]],
['AND' => [['kw LIKE' => $word_4],['kw LIKE' => $word_5],['kw LIKE' => $word_6]]]],
['NOT' => [['kw LIKE' => $word_7],['kw LIKE' => $word_8],['kw LIKE' => $word_9]]]
]);
четверг, 4 июня 2015 г., 1:42:04 UTC+5 пользователь José Lorenzo написал:
What have you tried so far? Did you read the documentation on creating queries in cake 3?
On Wednesday, June 3, 2015 at 7:58:44 AM UTC+2, InYan wrote:in cakephp v.1.3.x I used $this->Model->query($q);
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment