Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 36 |
| SurveyAnswer | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
42.00 | |
0.00% |
0 / 36 |
| 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 / 10 |
|||
| getSurveyOpinion | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getSurveyQuestion | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| <?php | |
| namespace common\models; | |
| use Yii; | |
| use yii\behaviors\TimestampBehavior; | |
| use yii\db\ActiveRecord; | |
| /** | |
| * This is the model class for table "{{%survey_answer}}". | |
| * | |
| * @property integer $id | |
| * @property string $content | |
| * @property float $value | |
| * @property integer $created_at | |
| * @property integer $survey_opinion_id | |
| * @property integer $survey_question_id | |
| * | |
| * @property SurveyOpinion $surveyOpinion | |
| * @property SurveyQuestion $surveyQuestion | |
| */ | |
| class SurveyAnswer extends ActiveRecord | |
| { | |
| /** | |
| * @inheritdoc | |
| */ | |
| public static function tableName() | |
| { | |
| return '{{%survey_answer}}'; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function behaviors() | |
| { | |
| return [ | |
| [ | |
| 'class' => TimestampBehavior::className(), | |
| 'attributes' => [ | |
| ActiveRecord::EVENT_BEFORE_INSERT => ['created_at'], | |
| ], | |
| ], | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function rules() | |
| { | |
| return [ | |
| [['content', 'value', 'survey_opinion_id', 'survey_question_id'], 'required'], | |
| [['content'], 'string', 'max' => 1500], | |
| [['value', 'survey_opinion_id', 'survey_question_id'], 'integer'], | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function attributeLabels() | |
| { | |
| return [ | |
| 'id' => Yii::t('app', 'ID'), | |
| 'content' => Yii::t('app', 'Content'), | |
| 'value' => Yii::t('app', 'Value'), | |
| 'created_at' => Yii::t('app', 'Created at'), | |
| 'survey_opinion_id' => Yii::t('app', 'Survey opinion'), | |
| 'survey_question_id' => Yii::t('app', 'Survey question'), | |
| ]; | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getSurveyOpinion() | |
| { | |
| return $this->hasOne(SurveyOpinion::className(), ['id' => 'survey_opinion_id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getSurveyQuestion() | |
| { | |
| return $this->hasOne(SurveyQuestion::className(), ['id' => 'survey_question_id']); | |
| } | |
| } |