Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 34 |
| SurveyOption | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
30.00 | |
0.00% |
0 / 34 |
| tableName | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| behaviors | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 11 |
|||
| rules | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 7 |
|||
| attributeLabels | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 10 |
|||
| getSurveyQuestion | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| <?php | |
| namespace common\models; | |
| use common\components\OrderNumberBehavior; | |
| use Yii; | |
| use yii\behaviors\TimestampBehavior; | |
| use yii\db\Expression; | |
| /** | |
| * This is the model class for table "{{%survey_option}}". | |
| * | |
| * @property integer $id | |
| * @property string $content | |
| * @property float $value | |
| * @property integer $created_at | |
| * @property integer $updated_at | |
| * @property integer $survey_question_id | |
| * | |
| * @property SurveyQuestion $surveyQuestion | |
| */ | |
| class SurveyOption extends \yii\db\ActiveRecord | |
| { | |
| /** | |
| * @inheritdoc | |
| */ | |
| public static function tableName() | |
| { | |
| return '{{%survey_option}}'; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function behaviors() | |
| { | |
| return [ | |
| TimestampBehavior::className(), | |
| [ | |
| 'class' => OrderNumberBehavior::className(), | |
| 'orderAttribute' => 'value', | |
| 'filter' => function($event, $attribute) { | |
| return ['survey_question_id' => $this->survey_question_id]; | |
| }, | |
| ], | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function rules() | |
| { | |
| return [ | |
| [['content', 'value', 'survey_question_id'], 'required'], | |
| [['value', 'survey_question_id'], 'integer'], | |
| [['content'], 'string', 'max' => 255], | |
| ]; | |
| } | |
| /** | |
| * @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'), | |
| 'updated_at' => Yii::t('app', 'Updated at'), | |
| 'survey_question_id' => Yii::t('app', 'Survey question'), | |
| ]; | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getSurveyQuestion() | |
| { | |
| return $this->hasOne(SurveyQuestion::className(), ['id' => 'survey_question_id']); | |
| } | |
| } |