Tag Archives: Yii2.0 Upsert

Yii Framework 2 : Upsert Query

Upsert is an atomic operation. `Upsert()` will insert new record into a database table If table do not already exist or update them. upsert( $table, $insertColumns, $updateColumns = true, $params = []) Using QueryBuilder $sql = $queryBuilder->upsert(‘pages’, [ ‘name’ => ‘Home page’, ‘url’ => ‘https://bsourcecode.com/’, // url is unique ‘visits’ => 10000, ], [ ‘visits’ […]