예제 #1
0
 /**
  * Finds the Mother model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Mother the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Mother::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #2
0
파일: _form.php 프로젝트: ramosisw/domotic
use yii\helpers\ArrayHelper;
use app\models\Mother;
use app\models\Tarea;
/* @var $this yii\web\View */
/* @var $model app\models\personas */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="personas-form">

    <?php 
$form = ActiveForm::begin();
?>
	
	<?php 
echo $form->field($model, 'id_mother')->dropDownList(ArrayHelper::map(Mother::find()->all(), 'id', 'nombre'))->label('Mother');
?>

    <?php 
echo $form->field($model, 'nombre')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'orden')->textInput();
?>

	<?php 
echo $form->field($model, 'relPersonaTareas[]')->checkboxList(ArrayHelper::map(Tarea::find()->all(), 'id', 'nombre'))->label('Tareas');
?>

    <div class="form-group">
예제 #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdMother()
 {
     return $this->hasOne(Mother::className(), ['id' => 'id_mother']);
 }
예제 #4
0
 public function actionIndex()
 {
     $model = Mother::find()->all();
     return $this->render('index', ['model' => $model]);
 }