Skip to content

Instantly share code, notes, and snippets.

@Modicrumb
Created January 16, 2019 21:31
Show Gist options
  • Save Modicrumb/2f944df2a9065c1258b7331aa201a60e to your computer and use it in GitHub Desktop.
Save Modicrumb/2f944df2a9065c1258b7331aa201a60e to your computer and use it in GitHub Desktop.
<?php
$entities = $this->Servers->find()
->contain('Defines', function($q) use ($service) {
return $q
->contain(['Environments', 'Services'])
->where(['Environments.name' => $this->envName])
->where(['Services.name' => $service]);
});
$entities = $this->Servers->find()
->contain(
[
'Defines' => [
'Environments' => [
'queryBuilder' => function ($q) {
return $q->where(['Environments.name' => $this->envName]);
}
],
'Services' => [
]
]
]
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment