2017 © Pedro Peláez
 

yii2-extension yii2-insert-update-behavior

Simple Behavior INSERT ON DUPLICATE KEY UPDATE or INSERT IGNORE

image

kozhemin/yii2-insert-update-behavior

Simple Behavior INSERT ON DUPLICATE KEY UPDATE or INSERT IGNORE

  • Monday, May 1, 2017
  • by kozhemin
  • Repository
  • 1 Watchers
  • 2 Stars
  • 174 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 58 % Grown

The README.md

Yii2 Insert Update Behavior

Simple Behavior INSERT ON DUPLICATE KEY UPDATE or INSERT IGNORE, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require kozhemin/yii2-insert-update-behavior:dev-master

or add, (*4)

"kozhemin/yii2-insert-update-behavior": "dev-master"

to the require section of your composer.json file., (*5)

Usage

This behavior allows you to create queries for INSERT ON DUPLICATE KEY UPDATE or INSERT IGNORE, (*6)

For example:, (*7)

Attach a new behavior to your model, (*8)

   public function behaviors()
   {
       return[
            \kozhemin\dbHelper\InsertUpdate::className(),
       ];
   }

usage, (*9)

   $dataInsert = [ ['title text', 'description'], ['title2 text', 'description2'], ['title3 text', 'descriptio3'] ];
   //Optional column parameter
   $column = ['title', 'description'];
    //INSERT ON DUPLICATE KEY UPDATE
    $model = new Post();
    $model->InsertUpdate($dataInsert, $column)

or, (*10)

    //INSERT IGNORE
    $model = new Post();
    $model->insertIgnore($dataInsert, $column)

The Versions

01/05 2017

dev-master

9999999-dev

Simple Behavior INSERT ON DUPLICATE KEY UPDATE or INSERT IGNORE

  Sources   Download

MIT

The Requires

 

by Egor Kozhemin

extension yii2