Download the PHP package tecnocen/yii2-rmdb without Composer
On this page you can find all versions of the php package tecnocen/yii2-rmdb. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yii2-rmdb
Yii2 RMDB Classes
Library with migrations and models to easily create RMDB tables and models.
Instalation
You can use composer to install the library tecnocen/yii2-rmdb
by running the
command;
composer require tecnocen/yii2-rmdb
or edit the composer.json
file
Usage
Create Migrations
There are 3 migration classes for each type of RMDB tables.
tecnocen\rmdb\migrations\CreatePivot
Uses the properties $createdByColumn
, $createdAtColumn
and methods
createdByDefinition()
, createdAtDefinition()
to store the user and datetime
a record was created.
tecnocen\rmdb\migrations\CreateEntity
Extends the previous class adding the properties $updatedByColumn
,
$updatedAtColumn
and methods updatedByDefinition()
, updatedAtDefinition()
to store the user and datetime a record was updated.
tecnocen\rmdb\migrations\CreatePersistentEntity
A persistent entity remains stored in the database after the user deletes it.
The library yii2tech/ar-softdelete provides support for this functionality.
CreateEntity
extends the previous class adding the properties
$deletedByColumn
, $deletedAtColumn
and methods deletedByDefinition()
,
deletedAtDefinition()
to store the user and datetime a record was deleted.
RMDB Module
This library uses a custom module to help configure all the extended models in an unified way.
configure it in your common\config\main.php
in yii-app-advanced
and
common\config.php
in yii-app-basic
.
Models
Like the migrations there are 3 classes for models.
tecnocen\rmdb\models\Pivot
Adds protected properties $createdByAttribute
and $createdAtAttribute
to
configure the names of the attributes. The class will automatically load the
needed behaviors and configure them to use the attributes as provided by this
properties.
tecnocen\rmdb\models\Entity
Extends the previos class and adds protected properties $updatedByAttribute
and $updatedAtAttribute
to configure the names of the attributes. The class
will automatically load the needed behaviors and configure them to use the
attributes as provided by this properties.
tecnocen\rmdb\models\PersistentEntity
Extends the previos class and adds protected properties $deletedByAttribute
and $deletedAtAttribute
to configure the names of the attributes. The class
will automatically load the needed behaviors and configure them to use the
attributes as provided by this properties.