Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 12 |
| MessageResource | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
12.00 | |
0.00% |
0 / 12 |
| getLinks | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 6 |
|||
| getReciverUser | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getSenderUser | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| <?php | |
| namespace api\modules\v1\models; | |
| use common\models\Message; | |
| use yii\base\Model; | |
| use yii\web\Link; // represents a link object as defined in JSON Hypermedia API Language. | |
| use yii\web\Linkable; | |
| use yii\helpers\Url; | |
| /** | |
| * This is the resource class for model `common\models\Message`. | |
| */ | |
| class MessageResource extends Message implements Linkable | |
| { | |
| public function getLinks() | |
| { | |
| return [ | |
| Link::REL_SELF => Url::to(['message/view', 'id' => $this->id], true), | |
| 'index' => Url::to(['message/index'], true), | |
| ]; | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getReciverUser() | |
| { | |
| return $this->hasOne(UserResource::className(), ['id' => 'reciver_user_id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getSenderUser() | |
| { | |
| return $this->hasOne(UserResource::className(), ['id' => 'sender_user_id']); | |
| } | |
| } |