Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 8 |
CRAP | |
0.00% |
0 / 40 |
| EventSurvey | |
0.00% |
0 / 1 |
|
0.00% |
0 / 8 |
72.00 | |
0.00% |
0 / 40 |
| tableName | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| behaviors | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 10 |
|||
| rules | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 7 |
|||
| attributeLabels | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 8 |
|||
| getEvent | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getSurvey | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getEventSurveyLocks | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| find | |
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 "{{%event_survey}}". | |
| * | |
| * @property string $id | |
| * @property string $created_at | |
| * @property string $survey_id | |
| * @property string $event_id | |
| * | |
| * @property Event $event | |
| * @property Survey $survey | |
| * @property EventSurveyLock[] $eventSurveyLocks | |
| */ | |
| class EventSurvey extends \yii\db\ActiveRecord | |
| { | |
| /** | |
| * @inheritdoc | |
| */ | |
| public static function tableName() | |
| { | |
| return '{{%event_survey}}'; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function behaviors() | |
| { | |
| return [ | |
| [ | |
| 'class' => TimestampBehavior::className(), | |
| 'attributes' => [ | |
| static::EVENT_BEFORE_INSERT => ['created_at'], | |
| ], | |
| ], | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function rules() | |
| { | |
| return [ | |
| [['survey_id', 'event_id'], 'required'], | |
| [['survey_id', 'event_id'], 'integer'], | |
| [['survey_id', 'event_id'], 'unique', 'targetAttribute' => ['survey_id', 'event_id'], 'message' => Yii::t('app', 'The combination of Survey and Event has already been taken.')] | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function attributeLabels() | |
| { | |
| return [ | |
| 'id' => Yii::t('app', 'ID'), | |
| 'created_at' => Yii::t('app', 'Created At'), | |
| 'survey_id' => Yii::t('app', 'Survey ID'), | |
| 'event_id' => Yii::t('app', 'Event ID'), | |
| ]; | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getEvent() | |
| { | |
| return $this->hasOne(Event::className(), ['id' => 'event_id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getSurvey() | |
| { | |
| return $this->hasOne(Survey::className(), ['id' => 'survey_id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getEventSurveyLocks() | |
| { | |
| return $this->hasMany(EventSurveyLock::className(), ['event_survey_id' => 'id']); | |
| } | |
| /** | |
| * @inheritdoc | |
| * @return EventSurveyQuery | |
| */ | |
| public static function find() | |
| { | |
| return new EventSurveyQuery(get_called_class()); | |
| } | |
| } |