/**
  * @return \yii\db\ActiveQuery
  */
 public function getIdcomercio0()
 {
     return $this->hasOne(Comercios::className(), ['id' => 'idcomercio']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdcomercios()
 {
     return $this->hasMany(Comercios::className(), ['id' => 'idcomercio'])->viaTable('ruta_comercio', ['idruta' => 'id']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdcomercios()
 {
     return $this->hasMany(Comercios::className(), ['id' => 'idcomercio'])->viaTable('producto_tienda', ['idproducto' => 'id']);
 }
 /**
  * Finds the Comercios model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Comercios the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Comercios::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }