LoginSignup
1
1

More than 5 years have passed since last update.

CakePHP3でリレーション先のモデルのカラムを取得条件に指定

Posted at

matchingメソッドを使う
Emails.emailを条件にUsersを取得。

// メール送信対象のユーザー一覧取得
$sleepUsers = $this->find('all', [
     'conditions' => [
          'Users.delete_flag' => 0
      ]
])->matching('Emails', function ($q) {
      return $q->where([
           'Emails.email' => $email,
      ]);
})->toArray();
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1