Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 7 |
CRAP | |
0.00% |
0 / 44 |
| AccompanyingEvent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 7 |
56.00 | |
0.00% |
0 / 44 |
| 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 / 12 |
|||
| attributeLabels | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 15 |
|||
| getParentEvent | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| getParticipants | |
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 "{{%accompanying_event}}". | |
| * | |
| * @property string $id | |
| * @property string $name | |
| * @property string $date | |
| * @property string $time | |
| * @property string $limit | |
| * @property string $registration_from | |
| * @property string $registration_to | |
| * @property integer $is_enabled | |
| * @property string $created_at | |
| * @property string $updated_at | |
| * @property string $parent_event_id | |
| * | |
| * @property Event $parentEvent | |
| * @property Participant[] $participants | |
| */ | |
| class AccompanyingEvent extends \yii\db\ActiveRecord | |
| { | |
| /** | |
| * @inheritdoc | |
| */ | |
| public static function tableName() | |
| { | |
| return '{{%accompanying_event}}'; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function behaviors() | |
| { | |
| return [ | |
| TimestampBehavior::className(), | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function rules() | |
| { | |
| return [ | |
| [['name', 'date', 'time'], 'filter', 'filter' => 'trim'], | |
| [['name', 'date', 'time', 'parent_event_id'], 'required'], | |
| [['date', 'time', 'registration_from', 'registration_to'], 'safe'], | |
| [['time'], 'date', 'format' => 'HH:mm'], | |
| [['limit', 'is_enabled', 'parent_event_id'], 'integer'], | |
| [['name'], 'string', 'max' => 255], | |
| ['registration_to', 'compare', 'compareAttribute' => 'registration_from', 'operator' => '>='], | |
| ['is_enabled', 'default', 'value' => true], | |
| ]; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function attributeLabels() | |
| { | |
| return [ | |
| 'id' => Yii::t('app', 'ID'), | |
| 'name' => Yii::t('app', 'Name'), | |
| 'date' => Yii::t('app', 'Date'), | |
| 'time' => Yii::t('app', 'Time'), | |
| 'limit' => Yii::t('app', 'Limit'), | |
| 'registration_from' => Yii::t('app', 'Registration From'), | |
| 'registration_to' => Yii::t('app', 'Registration To'), | |
| 'is_enabled' => Yii::t('app', 'Is Enabled'), | |
| 'created_at' => Yii::t('app', 'Created At'), | |
| 'updated_at' => Yii::t('app', 'Updated At'), | |
| 'parent_event_id' => Yii::t('app', 'Parent Event ID'), | |
| ]; | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getParentEvent() | |
| { | |
| return $this->hasOne(Event::className(), ['id' => 'parent_event_id']); | |
| } | |
| /** | |
| * @return \yii\db\ActiveQuery | |
| */ | |
| public function getParticipants() | |
| { | |
| return $this->hasMany(Participant::className(), ['id' => 'participant_id'])->viaTable('{{%participant_accompanying_event}}', ['accompanying_event_id' => 'id']); | |
| } | |
| /** | |
| * @inheritdoc | |
| * @return AccompanyingEventQuery | |
| */ | |
| public static function find() | |
| { | |
| return new AccompanyingEventQuery(get_called_class()); | |
| } | |
| } |