Showing posts with label Yii2 batch insert. Show all posts
Showing posts with label Yii2 batch insert. Show all posts

Wednesday, March 28, 2018

Yii2 batch update

In batch query method we can retrieve data in batches. We can use batch using yii\db\Query::batch().

Yii2 batch update


$rows = $query->select(['name','email'])
                    ->from('tblName1')
                    ->all();
$columnNames = ['name','email'];
$result = \Yii::$app->db->createCommand()->batchInsert('tblName2', $columnNames, $rows)->execute();

Recent Update

yii2 session handling

use yii\web\Session; $session = Yii::$app->session; // start session $session->open(); // close session $session->close(); ...

Most Search