Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 17 |
CRAP | |
0.00% |
0 / 89 |
| Participant | |
0.00% |
0 / 1 |
|
0.00% |
0 / 17 |
380.00 | |
0.00% |
0 / 85 |
| 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 / 13 |
|||
| attributeLabels | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 15 |
|||
| 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 |
|||
| find | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getEventSpansList | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 6 |
|||
| setEventSpansList | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getAccompanyingEventsList | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 6 |
|||
| setAccompanyingEventsList | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| afterFind | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 6 |
|||
| afterSave | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 4 |
|||
| <?php | |
| namespace common\models; | |
| use Yii; | |
| use yii\behaviors\TimestampBehavior; | |
| /** | |
| * This is the model class for table "{{%participant}}". | |
| * | |
| * @property integer $id | |
| * @property string $phone | |
| * @property string $description | |
| * @property string $image | |
| * @property integer $is_support_only | |
| * @property integer $created_at | |
| * @property integer $updated_at | |
| * @property integer $organization_id | |
| * @property integer $user_id | |
| * | |
| * @property Organization $organization | |
| * @property User $user | |
| * @property AccompanyingEvent[] $accompanyingEvents | |
| * @property EventSpan[] $eventSpans | |
| * @property Meeting[] $meetings | |
| * @property Meeting[] $invitations | |
| */ | |
| class Participant extends \yii\db\ActiveRecord | |
| { | |
| /** | |
| * @inheritdoc | |
| */ | |
| public static function tableName() | |
| { | |
| return '{{%participant}}'; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function behaviors() | |
| { | |
| return [ | |
| TimestampBehavior::className(), | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function rules() | |
| { | |
| return [ | |
| [['phone', 'description', 'is_support_only', 'organization_id', 'user_id'], 'required'], | |
| [['description'], 'string'], | |
| [['is_support_only'], 'boolean'], | |
| [['organization_id', 'user_id'], 'integer'], | |
| [['phone'], 'string', 'max' => 20], | |
| [['image'], 'image', 'on' => 'updateImage'], | |
| [['eventSpansList'], 'safe'], | |
| [['eventSpansList'], 'required'], | |
| [['accompanyingEventsList'], 'safe'], | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function attributeLabels() | |
| { | |
| return [ | |
| 'id' => Yii::t('app', 'ID'), | |
| 'phone' => Yii::t('app', 'Phone'), | |
| 'description' => Yii::t('app', 'Description'), | |
| 'image' => Yii::t('app', 'Image'), | |
| 'is_support_only' => Yii::t('app', 'Supporting'), | |
| 'created_at' => Yii::t('app', 'Created at'), | |
| 'updated_at' => Yii::t('app', 'Updated at'), | |
| 'organization_id' => Yii::t('app', 'Organization'), | |
| 'user_id' => Yii::t('app', 'User'), | |
| 'eventSpansList' => Yii::t('app', 'Event spans'), | |
| 'accompanyingEventsList' => Yii::t('app', 'Accompanying events'), | |
| ]; | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getOrganization() | |
| { | |
| return $this->hasOne(Organization::className(), ['id' => 'organization_id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getUser() | |
| { | |
| return $this->hasOne(User::className(), ['id' => 'user_id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getAccompanyingEvents() | |
| { | |
| return $this->hasMany(AccompanyingEvent::className(), ['id' => 'accompanying_event_id'])->viaTable('{{%participant_accompanying_event}}', ['participant_id' => 'id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getEventSpans() | |
| { | |
| return $this->hasMany(EventSpan::className(), ['id' => 'event_span_id'])->viaTable('{{%participant_event_span}}', ['participant_id' => 'id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getMeetings() | |
| { | |
| return $this->hasMany(Meeting::className(), ['host_participant_id' => 'id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getInvitations() | |
| { | |
| return $this->hasMany(Meeting::className(), ['guest_participant_id' => 'id']); | |
| } | |
| /** | |
| * @inheritdoc | |
| * @return ParticipantQuery | |
| */ | |
| public static function find() | |
| { | |
| return new ParticipantQuery(get_called_class()); | |
| } | |
| private $isEventSpansListReady; | |
| private $eventSpansList; | |
| public function getEventSpansList(){ | |
| if(!$this->isEventSpansListReady){ | |
| $this->isEventSpansListReady = true; | |
| \common\components\RelationHelper::SetJunctionList($this, 'eventSpans'); | |
| } | |
| return $this->eventSpansList; | |
| } | |
| public function setEventSpansList($value){ | |
| $this->isEventSpansListReady = true; | |
| $this->eventSpansList = $value; | |
| } | |
| private $isAccompanyingEventsListReady; | |
| private $accompanyingEventsList; | |
| public function getAccompanyingEventsList(){ | |
| if(!$this->isAccompanyingEventsListReady){ | |
| $this->isAccompanyingEventsListReady = true; | |
| \common\components\RelationHelper::SetJunctionList($this, 'accompanyingEvents'); | |
| } | |
| return $this->accompanyingEventsList; | |
| } | |
| public function setAccompanyingEventsList($value){ | |
| $this->isAccompanyingEventsListReady = true; | |
| $this->accompanyingEventsList = $value; | |
| } | |
| public function afterFind() { | |
| $this->isEventSpansListReady = false; | |
| $this->eventSpansList = []; | |
| $this->isAccompanyingEventsListReady = false; | |
| $this->accompanyingEventsList = []; | |
| parent::afterFind(); | |
| } | |
| public function afterSave($insert, $changedAttributes) { | |
| \common\components\RelationHelper::UpdateJunctionList($this, 'eventSpans'); | |
| \common\components\RelationHelper::UpdateJunctionList($this, 'accompanyingEvents'); | |
| parent::afterSave($insert, $changedAttributes); | |
| } | |
| } |