Monday, December 28, 2009

a double criteria case

I have to show on a list some data but it has to be filtred by one
estado_id dependeing o the logge user, an user has an estado_id, an i
have to do a filter of Fundos, Fundos has parroquia_id->Parroquia, in
Parroquia i have Municipio_id->Municipio,an then i have in Municipio
estado_id that belongs to Estado and must be use to macth the
estado_id o the user logged, i did a filter before like this but from
Municipio to Estado, doing this

function beforeFilter() {
parent::beforeFilter();
if($this->Auth->user('grupo_id')!=7){
$this->criteria = array("Municipio.estado_id" =>
$this->Auth->user('estado_id'));
}

}

now i'm triying to do somthing like it but i don't know how to make a
double criteria or do a filter firts by Municipio and then go down one
level (or go up) To Parroquia, i have this

function beforeFilter() {
parent::beforeFilter();

$this->Wizard->steps = array
('beneficiario','fundo','imagenfundo');
$this->Wizard->completeUrl = '/fundos/index';

//$conditionsSubQuery['"Municipio"."estado_id"'] = $this->Auth->user
('estado_id');

$this->criteria = array ("Parroquia.municipio_id" => array
('Municipio.estado_id' => $this->Auth->user('estado_id')));

//}
}


But i'm kind o lost here, i'm new in cakephp please help me, i was
reading about subqueries but nothing =(

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: