Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PacienteController:
- public function actionAdmin() {
- //$model = new Paciente('search');
- $model = new Usuario('searchWithRelation');
- $model->unsetAttributes(); // clear any default values
- if (isset($_GET['Usuario'])) {
- $model->attributes = $_GET['Usuario'];
- }
- $this->render('admin', array(
- 'model' => $model,
- ));
- }
- Modelo Usuario:
- public function searchWithRelation() {
- // @todo Please modify the following code to remove attributes that should not be searched.
- $criteria = new CDbCriteria;
- $criteria->together = true;
- $criteria->with = array('paciente');
- $criteria->compare('id', $this->id);
- $criteria->compare('rut', $this->rut, true);
- $criteria->compare('nombre', $this->nombre, true);
- $criteria->compare('apellidoPaterno', $this->apellidoPaterno, true);
- $criteria->compare('apellidoMaterno', $this->apellidoMaterno, true);
- $criteria->compare('estado', 1);
- return new CActiveDataProvider($this, array(
- 'pagination' => array(
- 'pageSize' => 15,
- ),
- 'criteria' => $criteria,
- ));
- }
- CGridView de Pacientes:
- 'dataProvider' => $model->searchWithRelation(), //cargo modelo usuarios que son tipo paciente.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement