Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 8 |
CRAP | |
0.00% |
0 / 27 |
| ParticipantResource | |
0.00% |
0 / 1 |
|
0.00% |
0 / 8 |
72.00 | |
0.00% |
0 / 27 |
| extraFields | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getLinks | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 6 |
|||
| getOrganization | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getUser | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getAccompanyingEvents | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getEventSpans | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getMeetings | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getInvitations | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| <?php | |
| namespace api\modules\v1\models; | |
| use common\models\Participant; | |
| 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\Participant`. | |
| */ | |
| class ParticipantResource extends Participant implements Linkable | |
| { | |
| public function extraFields() | |
| { | |
| return ['user', 'organization']; | |
| } | |
| public function getLinks() | |
| { | |
| return [ | |
| Link::REL_SELF => Url::to(['participant/view', 'id' => $this->id], true), | |
| 'index' => Url::to(['participant/index'], true), | |
| ]; | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getOrganization() | |
| { | |
| return $this->hasOne(OrganizationResource::className(), ['id' => 'organization_id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getUser() | |
| { | |
| return $this->hasOne(UserResource::className(), ['id' => 'user_id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getAccompanyingEvents() | |
| { | |
| return $this->hasMany(AccompanyingEventResource::className(), ['id' => 'accompanying_event_id'])->viaTable('{{%participant_accompanying_event}}', ['participant_id' => 'id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getEventSpans() | |
| { | |
| return $this->hasMany(EventSpanResource::className(), ['id' => 'event_span_id'])->viaTable('{{%participant_event_span}}', ['participant_id' => 'id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getMeetings() | |
| { | |
| return $this->hasMany(MeetingResource::className(), ['host_participant_id' => 'id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getInvitations() | |
| { | |
| return $this->hasMany(MeetingResource::className(), ['guest_participant_id' => 'id']); | |
| } | |
| } |