Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 12 |
CRAP | |
0.00% |
0 / 54 |
| Survey | |
0.00% |
0 / 1 |
|
0.00% |
0 / 12 |
156.00 | |
0.00% |
0 / 54 |
| 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 / 11 |
|||
| attributeLabels | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 11 |
|||
| getAccompanyingEventSurvey | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getEventSurvey | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getMeetingSurvey | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getSurveyLocks | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getSurveyOpinions | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getSurveyQuestions | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| computeAnsweredQuantity | |
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 "{{%survey}}". | |
| * | |
| * @property integer $id | |
| * @property string $name | |
| * @property string $available_from | |
| * @property string $available_to | |
| * @property string $answered_quantity | |
| * @property integer $created_at | |
| * @property integer $updated_at | |
| * | |
| * @property AccompanyingEventSurvey? $accompanyingEventSurvey | |
| * @property EventSurvey? $eventSurvey | |
| * @property MeetingSurvey? $meetingSurvey | |
| * @property SurveyLock[] $surveyLocks | |
| * @property SurveyOpinion[] $surveyOpinions | |
| * @property SurveyQuestion[] $surveyQuestions | |
| */ | |
| class Survey extends \yii\db\ActiveRecord | |
| { | |
| /** | |
| * @inheritdoc | |
| */ | |
| public static function tableName() | |
| { | |
| return '{{%survey}}'; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function behaviors() | |
| { | |
| return [ | |
| TimestampBehavior::className(), | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function rules() | |
| { | |
| return [ | |
| [['available_from', 'available_to'], 'filter', 'filter' => 'trim'], | |
| [['name'], 'required'], | |
| [['available_from', 'available_to'], 'date', 'format' => 'yyyy-MM-dd HH:mm:ss'], | |
| [['answered_quantity'], 'integer'], | |
| [['name'], 'string', 'max' => 30], | |
| ['available_to', 'compare', 'compareAttribute' => 'available_from', 'operator' => '>='], | |
| [['name'], 'unique'] | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function attributeLabels() | |
| { | |
| return [ | |
| 'id' => Yii::t('app', 'ID'), | |
| 'name' => Yii::t('app', 'Name'), | |
| 'available_from' => Yii::t('app', 'Available from'), | |
| 'available_to' => Yii::t('app', 'Available to'), | |
| 'answered_quantity' => Yii::t('app', 'Answered quantity'), | |
| 'created_at' => Yii::t('app', 'Created at'), | |
| 'updated_at' => Yii::t('app', 'Updated at'), | |
| ]; | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getAccompanyingEventSurvey() | |
| { | |
| return $this->hasOne(AccompanyingEventSurvey::className(), ['survey_id' => 'id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getEventSurvey() | |
| { | |
| return $this->hasOne(EventSurvey::className(), ['survey_id' => 'id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getMeetingSurvey() | |
| { | |
| return $this->hasOne(MeetingSurvey::className(), ['survey_id' => 'id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getSurveyLocks() | |
| { | |
| return $this->hasMany(SurveyLock::className(), ['survey_id' => 'id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getSurveyOpinions() | |
| { | |
| return $this->hasMany(SurveyOpinion::className(), ['survey_id' => 'id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getSurveyQuestions() | |
| { | |
| return $this->hasMany(SurveyQuestion::className(), ['survey_id' => 'id']); | |
| } | |
| /** | |
| * @return integer | |
| */ | |
| public function computeAnsweredQuantity() | |
| { | |
| return $this->answered_quantity = $this->getSurveyOpinions()->count(); | |
| } | |
| /** | |
| * @inheritdoc | |
| * @return SurveyQuery | |
| */ | |
| public static function find() | |
| { | |
| return new SurveyQuery(get_called_class()); | |
| } | |
| } |