LoginSignup
0
0

More than 3 years have passed since last update.

テーブルにエイリアスを設定する方法【CakePHP4】

Posted at

CakePHP4で使用するテーブルにエイリアスを設定する

// 使い方
$query = $this->setAlias('モデルのエイリアス名')->find()
           ->select([
             'モデルのエイリアス名.値',
           ])
           ->enableHydration(false)
           ->first();

// 使用例
$query = $this->setAlias('User')->find()
           ->select([
             'id' => 'User.id',
             'name' => 'User.name'
           ])
           ->enableHydration(false)
           ->first();
0
0
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
0
0