I’ve have these tables:
– Proyectos
– Hitos
– Tareas
*a project belongs to user and has many hitos and (optionally) tareas
*a hito belongs to user and project and has many hitos and (optionally) tareas
*a tarea belongs to user, project and hito
Now I want to retrieve those hitos which belong to user and those tareas which belong to the same user with this code:
$con1=array('OR' => array(
'Hito.usuario_id'=>$this->Session->read('Usuario_id'),
'Tarea.usuario_id' => $this->Session->read('Usuario_id'),
));
$this->loadModel('Hito');
$hitos = $this->Hito->find('all',array(
'conditions' => $con1,
'group'=>array('Hito.id'),
));
I only get the Hitos part… I have some related tareas that I need to be in $hitos
Does someone know how to get them?
Thanks
I did something like that with “Query”
Change the SQL for whatever you need but dont forgot de “as Modelname” part for having your actual views working.