Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 12 |
| AccompanyingEventResource | |
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 |
|||
| getParentEvent | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getParticipants | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| <?php | |
| namespace api\modules\v1\models; | |
| use common\models\AccompanyingEvent; | |
| 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\AccompanyingEvent`. | |
| */ | |
| class AccompanyingEventResource extends AccompanyingEvent implements Linkable | |
| { | |
| public function getLinks() | |
| { | |
| return [ | |
| Link::REL_SELF => Url::to(['accompanying-event/view', 'id' => $this->id], true), | |
| 'index' => Url::to(['accompanying-event/index'], true), | |
| ]; | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getParentEvent() | |
| { | |
| return $this->hasOne(EventResource::className(), ['id' => 'parent_event_id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getParticipants() | |
| { | |
| return $this->hasMany(ParticipantResource::className(), ['id' => 'participant_id'])->viaTable('{{%participant_accompanying_event}}', ['accompanying_event_id' => 'id']); | |
| } | |
| } |