Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
CakePHP3 ORM match against 2 tags with LIKE, at least those 2 need to be m:n assigned, else no result.
if (array_key_exists('device_tags', $queryParams)
&& is_array($queryParams['device_tags'])
) {
foreach ($queryParams['device_tags'] as $queryParam) {
$subquery = $this->Devices->find()
->innerJoinWith('DevicesDeviceTags.DeviceTags', function ($qry) use ($queryParam) {
return $qry->where(['DeviceTags.identifier LIKE' => $queryParam]);
$qry->where([' IN' => $subquery]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.