Re: find problem on the associated model
yes the executions table isn't included in the applications query. I will try your code but mine should work, shouldn't it ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: find problem on the associated model
Hi wluigi, Set debug to 2 and you will almost certainly see that the execution table isnĀ“t included in the Application query. As you are looking for a specific Execution, why not restructure your code to be of the form: $ExecutionData=$this-Application-Execution-findById($ExecutionId); $applications = isset($ExecutionData['Application'])?$ExecutionData['Application']:Array(); etc. HTH, Cheers, AD7six --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
find problem on the associated model
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 cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: find problem on the associated model
I'm assuming you do actually have a table called executions...right? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: find problem on the associated model
yes and an other applications --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---