Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 30 |
| Page | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
30.00 | |
0.00% |
0 / 30 |
| tableName | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| behaviors | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 5 |
|||
| rules | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 8 |
|||
| attributeLabels | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 11 |
|||
| getUser | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| <?php | |
| namespace common\models; | |
| use Yii; | |
| use yii\behaviors\TimestampBehavior; | |
| /** | |
| * This is the model class for table "{{%page}}". | |
| * | |
| * @property string $id | |
| * @property string $title | |
| * @property string $alias | |
| * @property string $content | |
| * @property string $created_at | |
| * @property string $updated_at | |
| * @property string $user_id | |
| * | |
| * @property User $user | |
| */ | |
| class Page extends \yii\db\ActiveRecord | |
| { | |
| /** | |
| * @inheritdoc | |
| */ | |
| public static function tableName() | |
| { | |
| return '{{%page}}'; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function behaviors() | |
| { | |
| return [ | |
| TimestampBehavior::className(), | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function rules() | |
| { | |
| return [ | |
| [['title', 'alias', 'content', 'created_at', 'user_id'], 'required'], | |
| [['content'], 'string'], | |
| [['created_at', 'updated_at', 'user_id'], 'integer'], | |
| [['title', 'alias'], 'string', 'max' => 150] | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function attributeLabels() | |
| { | |
| return [ | |
| 'id' => Yii::t('app', 'ID'), | |
| 'title' => Yii::t('app', 'Title'), | |
| 'alias' => Yii::t('app', 'Alias'), | |
| 'content' => Yii::t('app', 'Content'), | |
| 'created_at' => Yii::t('app', 'Created At'), | |
| 'updated_at' => Yii::t('app', 'Updated At'), | |
| 'user_id' => Yii::t('app', 'User ID'), | |
| ]; | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getUser() | |
| { | |
| return $this->hasOne(User::className(), ['id' => 'user_id']); | |
| } | |
| } |