PHP code example of marena / yii2-meta-trait

1. Go to this page and download the library: Download marena/yii2-meta-trait 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/ */

    

marena / yii2-meta-trait example snippets




use mipotech\metaActiveRecord\MetaActiveRecord;

class User extends MetaActiveRecord
{
	...
}

$user = new User;
$user->firstName = 'John';		// not part of user table schema
$user->lastName = 'Doe';		// not part of user table schema
$user->username = 'johndoe1';
$user->password = Yii::$app->security->generatePasswordHash('123456');
$user->email = '[email protected]';
$user->registered = time();
$ret = $user->save();

$user = User::findOne(['email'=>'[email protected]']);
$user->firstName = 'Jane';		// not part of user table schema
$user->lastName = 'Doe1';		// not part of user table schema
$user->save();

php composer.phar