67 lines
1.4 KiB
PHP
67 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace common\models;
|
|
|
|
use Yii;
|
|
use yii\behaviors\TimestampBehavior;
|
|
use yii\db\Expression;
|
|
|
|
/**
|
|
* This is the model class for table "project".
|
|
*
|
|
* @property int $id
|
|
* @property string $name
|
|
* @property string $description
|
|
* @property string $created_at
|
|
* @property string $updated_at
|
|
*/
|
|
class Project extends \yii\db\ActiveRecord
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public static function tableName()
|
|
{
|
|
return 'project';
|
|
}
|
|
|
|
public function behaviors()
|
|
{
|
|
return [
|
|
[
|
|
'class' => TimestampBehavior::class,
|
|
'createdAtAttribute' => 'created_at',
|
|
'updatedAtAttribute' => 'updated_at',
|
|
'value' => new Expression('NOW()'),
|
|
],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['name'], 'required'],
|
|
[['description'], 'string'],
|
|
[['created_at', 'updated_at'], 'safe'],
|
|
[['name'], 'string', 'max' => 255],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function attributeLabels()
|
|
{
|
|
return [
|
|
'id' => 'ID',
|
|
'name' => 'Название',
|
|
'description' => 'Описание',
|
|
'created_at' => 'Дата создания',
|
|
'updated_at' => 'Дата редактирования',
|
|
];
|
|
}
|
|
}
|