/** * @return \yii\db\ActiveQuery */ public function getSchedules() { return $this->hasMany(Schedule::className(), ['id' => 'model_id']); }
/** * Table creation. */ protected function createPackage() { $this->createTable(Schedule::className(), ['id' => Schema::TYPE_PK, 'model_id' => Schema::TYPE_INTEGER . ' NOT NULL', 'created_at' => Schema::TYPE_INTEGER, 'created_by' => Schema::TYPE_INTEGER, 'updated_at' => Schema::TYPE_INTEGER, 'updated_by' => Schema::TYPE_INTEGER]); $this->createTable($this->getTableName(), ['schedule_id' => Schema::TYPE_INTEGER . ' NOT NULL', 'day' => Schema::TYPE_INTEGER . ' NOT NULL', 'from' => Schema::TYPE_STRING . ' NOT NULL', 'to' => Schema::TYPE_STRING . ' NOT NULL', 'created_at' => Schema::TYPE_INTEGER, 'created_by' => Schema::TYPE_INTEGER, 'updated_at' => Schema::TYPE_INTEGER, 'updated_by' => Schema::TYPE_INTEGER]); }