Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 34 |
| SurveyLock | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
42.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 / 10 |
|||
| rules | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 7 |
|||
| attributeLabels | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 8 |
|||
| getSurvey | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getUser | |
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_lock}}". | |
| * | |
| * @property integer $id | |
| * @property integer $created_at | |
| * @property integer $user_id | |
| * @property integer $survey_id | |
| * | |
| * @property Survey $survey | |
| * @property User $user | |
| */ | |
| class SurveyLock extends ActiveRecord | |
| { | |
| /** | |
| * @inheritdoc | |
| */ | |
| public static function tableName() | |
| { | |
| return '{{%survey_lock}}'; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function behaviors() | |
| { | |
| return [ | |
| [ | |
| 'class' => TimestampBehavior::className(), | |
| 'attributes' => [ | |
| ActiveRecord::EVENT_BEFORE_INSERT => ['created_at'], | |
| ], | |
| ], | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function rules() | |
| { | |
| return [ | |
| [['user_id', 'survey_id'], 'required'], | |
| [['user_id', 'survey_id'], 'integer'], | |
| [['user_id', 'survey_id'], 'unique', 'targetAttribute' => ['user_id', 'survey_id']], | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function attributeLabels() | |
| { | |
| return [ | |
| 'id' => Yii::t('app', 'ID'), | |
| 'created_at' => Yii::t('app', 'Created at'), | |
| 'user_id' => Yii::t('app', 'User'), | |
| 'survey_id' => Yii::t('app', 'Survey'), | |
| ]; | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getSurvey() | |
| { | |
| return $this->hasOne(Survey::className(), ['id' => 'survey_id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getUser() | |
| { | |
| return $this->hasOne(User::className(), ['id' => 'user_id']); | |
| } | |
| } |