コード例 #1
0
ファイル: ActiveRecordTest.php プロジェクト: trntv/yii2
 public function testScriptFields()
 {
     $orderItems = OrderItem::find()->fields(['quantity', 'subtotal', 'total' => ['script' => "doc['quantity'].value * doc['subtotal'].value"]])->all();
     foreach ($orderItems as $item) {
         $this->assertEquals($item->subtotal * $item->quantity, $item->total);
     }
 }