Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 6
CRAP
0.00% covered (danger)
0.00%
0 / 36
AccompanyingEventSurveyLock
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 6
42.00
0.00% covered (danger)
0.00%
0 / 36
 tableName
0.00% covered (danger)
0.00%
0 / 1
2.00
0.00% covered (danger)
0.00%
0 / 3
 behaviors
0.00% covered (danger)
0.00%
0 / 1
2.00
0.00% covered (danger)
0.00%
0 / 10
 rules
0.00% covered (danger)
0.00%
0 / 1
2.00
0.00% covered (danger)
0.00%
0 / 9
 attributeLabels
0.00% covered (danger)
0.00%
0 / 1
2.00
0.00% covered (danger)
0.00%
0 / 8
 getAccompanyingEventSurvey
0.00% covered (danger)
0.00%
0 / 1
2.00
0.00% covered (danger)
0.00%
0 / 3
 getParticipant
0.00% covered (danger)
0.00%
0 / 1
2.00
0.00% covered (danger)
0.00%
0 / 3
<?php
namespace common\models;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
 * This is the model class for table "{{%accompanying_event_survey_lock}}".
 *
 * @property string $id
 * @property string $created_at
 * @property string $accompanying_event_survey_id
 * @property string $participant_id
 *
 * @property AccompanyingEventSurvey $accompanyingEventSurvey
 * @property Participant $participant
 */
class AccompanyingEventSurveyLock extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%accompanying_event_survey_lock}}';
    }
    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
            [
                'class' => TimestampBehavior::className(),
                'attributes' => [
                    static::EVENT_BEFORE_INSERT => ['created_at'],
                ],
            ],
        ];
    }
    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['accompanying_event_survey_id', 'participant_id'], 'required'],
            [['accompanying_event_survey_id', 'participant_id'], 'integer'],
            [['accompanying_event_survey_id', 'participant_id'], 'unique', 'targetAttribute' => ['accompanying_event_survey_id', 'participant_id'], 'message' => 'The combination of Accompanying Event Survey ID and Participant ID has already been taken.'],
            [['accompanying_event_survey_id'], 'exist', 'skipOnError' => true, 'targetClass' => AccompanyingEventSurvey::className(), 'targetAttribute' => ['accompanying_event_survey_id' => 'id']],
            [['participant_id'], 'exist', 'skipOnError' => true, 'targetClass' => Participant::className(), 'targetAttribute' => ['participant_id' => 'id']],
        ];
    }
    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'created_at' => Yii::t('app', 'Created At'),
            'accompanying_event_survey_id' => Yii::t('app', 'Accompanying Event Survey ID'),
            'participant_id' => Yii::t('app', 'Participant ID'),
        ];
    }
    /**
     * @return \yii\db\ActiveQuery
     */
    public function getAccompanyingEventSurvey()
    {
        return $this->hasOne(AccompanyingEventSurvey::className(), ['id' => 'accompanying_event_survey_id']);
    }
    /**
     * @return \yii\db\ActiveQuery
     */
    public function getParticipant()
    {
        return $this->hasOne(Participant::className(), ['id' => 'participant_id']);
    }
}