PHP code example of denq / yii2-record-replacer

1. Go to this page and download the library: Download denq/yii2-record-replacer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

denq / yii2-record-replacer example snippets


    'components' => [
        'RecordReplacer' => [
            'class' => 'RecordReplacer\RecordReplacer',
        ],
        ...
    ]

    Yii::$app->RecordReplacer->Run($model, $fields, $primary)

    Yii::$app->RecordReplacer->Run(new CustomModel, [
        'field_1' => 'val 1',
        'field_2' => 'val 2',
        ...
        'field_n' => 'val n',
    ], [
        'field_n'
    ]);