1. Go to this page and download the library: Download tecnocen/yii2-rmdb 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/ */
tecnocen / yii2-rmdb example snippets
class m170101_000001_product_sale extends \tecnocen\rmdb\migrations\CreatePivot
{
public $createdByColumn = 'creation_user';
public $createdAtColumn = 'creation_date';
public function getTableName()
{
return 'product_sale';
}
public function columns()
{
return [
'product_id' => ...,
'sale_id' => ...,
];
}
public function compositePrimaryKeys()
{
return ['product_id', 'sale_id'];
}
}
class m170101_000001_product extends \tecnocen\rmdb\migrations\CreateEntity
{
public $createdByColumn = 'creation_user';
public $createdAtColumn = 'creation_date';
public $updatedByColumn = 'edition_user';
public $updatedAtColumn = 'edition_date';
public function getTableName()
{
return 'product';
}
public function columns()
{
return [
'id' => $this->prymariKey()->...,
'name' => ...,
];
}
}
class m170101_000001_sale extends \tecnocen\rmdb\migrations\CreateEntity
{
public $createdByColumn = 'creation_user';
public $createdAtColumn = 'creation_date';
public $updatedByColumn = 'edition_user';
public $updatedAtColumn = 'edition_date';
public $deletedByColumn = 'deletion_user';
public $deletedAtColumn = 'deletion_date';
public function getTableName()
{
return 'product';
}
public function columns()
{
return [
'id' => $this->prymariKey()->...,
'store_id' => ...,
];
}
}