86 lines
2.2 KiB
PHP
86 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace common\models;
|
|
|
|
use Yii;
|
|
use yii\helpers\ArrayHelper;
|
|
use yii\behaviors\TimestampBehavior;
|
|
use common\components\AccountAwareBehavior;
|
|
use common\components\UserAwareBehavior;
|
|
|
|
/**
|
|
* This is the model class for table "money_movement".
|
|
*
|
|
* @property integer $id_money_movement
|
|
* @property integer $id_account
|
|
* @property integer $id_user
|
|
* @property string $name
|
|
* @property integer $type
|
|
* @property integer $money
|
|
* @property string $comment
|
|
* @property string $created_at
|
|
* @property string $updated_at
|
|
*/
|
|
class MoneyMovement extends \yii\db\ActiveRecord
|
|
{
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public static function tableName()
|
|
{
|
|
return 'money_movement';
|
|
}
|
|
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function behaviors()
|
|
{
|
|
return ArrayHelper::merge( [
|
|
[
|
|
'class' => TimestampBehavior::className(),
|
|
'value' => function(){ return date('Y-m-d H:i:s' ); }
|
|
],
|
|
[
|
|
'class' => AccountAwareBehavior::className(),
|
|
],
|
|
[
|
|
'class' => UserAwareBehavior::className(),
|
|
],
|
|
], parent::behaviors());
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['id_account', 'id_user', 'name', 'type', 'money'], 'required'],
|
|
[['id_account', 'id_user', 'type', 'money'], 'integer'],
|
|
[['name'], 'string', 'max' => 64],
|
|
[['comment'], 'string', 'max' => 255]
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function attributeLabels()
|
|
{
|
|
return [
|
|
'id_money_movement' => Yii::t('common/money-movement', 'Id Money Movement'),
|
|
'id_account' => Yii::t('common/money-movement', 'Id Account'),
|
|
'id_user' => Yii::t('common/money-movement', 'Id User'),
|
|
'name' => Yii::t('common/money-movement', 'Name'),
|
|
'type' => Yii::t('common/money-movement', 'Type'),
|
|
'money' => Yii::t('common/money-movement', 'Money'),
|
|
'comment' => Yii::t('common/money-movement', 'Comment'),
|
|
'created_at' => Yii::t('common/money-movement', 'Created At'),
|
|
'updated_at' => Yii::t('common/money-movement', 'Updated At'),
|
|
];
|
|
}
|
|
}
|