Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 35 |
| Message | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
42.00 | |
0.00% |
0 / 35 |
| 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 / 10 |
|||
| attributeLabels | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 11 |
|||
| getReciverUser | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getSenderUser | |
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 "{{%message}}". | |
| * | |
| * @property string $id | |
| * @property string $subject | |
| * @property string $body | |
| * @property string $created_at | |
| * @property string $updated_at | |
| * @property string $sender_user_id | |
| * @property string $reciver_user_id | |
| * | |
| * @property User $reciverUser | |
| * @property User $senderUser | |
| */ | |
| class Message extends \yii\db\ActiveRecord | |
| { | |
| /** | |
| * @inheritdoc | |
| */ | |
| public static function tableName() | |
| { | |
| return '{{%message}}'; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function behaviors() | |
| { | |
| return [ | |
| TimestampBehavior::className(), | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function rules() | |
| { | |
| return [ | |
| [['subject', 'body', 'sender_user_id', 'reciver_user_id'], 'required'], | |
| [['body'], 'string'], | |
| [['created_at', 'updated_at', 'sender_user_id', 'reciver_user_id'], 'integer'], | |
| [['subject'], 'string', 'max' => 150], | |
| [['reciver_user_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['reciver_user_id' => 'id']], | |
| [['sender_user_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['sender_user_id' => 'id']], | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function attributeLabels() | |
| { | |
| return [ | |
| 'id' => Yii::t('app', 'ID'), | |
| 'subject' => Yii::t('app', 'Subject'), | |
| 'body' => Yii::t('app', 'Body'), | |
| 'created_at' => Yii::t('app', 'Created At'), | |
| 'updated_at' => Yii::t('app', 'Updated At'), | |
| 'sender_user_id' => Yii::t('app', 'Sender User ID'), | |
| 'reciver_user_id' => Yii::t('app', 'Reciver User ID'), | |
| ]; | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getReciverUser() | |
| { | |
| return $this->hasOne(User::className(), ['id' => 'reciver_user_id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getSenderUser() | |
| { | |
| return $this->hasOne(User::className(), ['id' => 'sender_user_id']); | |
| } | |
| } |