I I'm trying to query all my applications with a condition on their
associated executions (hasMany relationship).
Adding this condition cause an SQL error:
SQL Error in model Application: 1109: Unknown table 'Execution' in
where clause
But this seems to work when I query my executions with a condition on
their applications (the result is right but doesn't look like what I
want).
Could someone explain me where I'm wrong.
That's the code.
My Models:
class Application extends AppModel{
var $name = 'Application';
var $hasMany = array( 'Execution' => array( 'className' =>
'Execution') );
}
class Execution extends AppModel{
var $name = 'Execution';
var $belongsTo =
array( 'Application' => array( 'className' => 'Application'));
}
My Controller:
class PagesController extends AppController{
var $name ='Pages';
var $uses =array('Application','Execution');
function display(){
//WORKS
/*
if(($applications=$this->Execution->findAll( array(
'Application.id' => '25'),
null,
null,
null,
null,
2))!=null){
*/
//DOESN T WORK AND I DON T KNOW WHY
if(($applications=$this->Application->findAll( array(
'Execution.id' => '179'),
null,
null,
null,
null,
2))!=null){
echo '<br/>on a un resultat';
pr($applications);
exit();
}
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---