/** * Creates a new Tipocaja model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionTipo() { $subModelTipo = new Tipocaja(); if ($subModelTipo->load(Yii::$app->request->post()) && $subModelTipo->save()) { return $this->actionIndex(); } else { return $this->render('../tipocaja/create', ['model' => $subModelTipo]); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Tipocaja::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['idTipoCaja' => $this->idTipoCaja]); $query->andFilterWhere(['like', 'Tipo', $this->Tipo]); return $dataProvider; }
/** * Finds the Tipocaja model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Tipocaja the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Tipocaja::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function getAllTipocaja() { return Tipocaja::find()->all(); //me da al controlador el arreglo de toda la tabla }
/** * @return \yii\db\ActiveQuery */ public function getTipoCajaIdTipoCaja() { return $this->hasOne(Tipocaja::className(), ['idTipoCaja' => 'TipoCaja_idTipoCaja']); }