Hi, >From your code, the relationships and DB schema are not clear to me. Please provide atleast DB schema to judge proper relations.
Amit Badkas PHP Applications for E-Biz: http://www.sanisoft.com On Mon, Dec 13, 2010 at 5:10 PM, casualman <[email protected]> wrote: > > Hi Amit > > Thank you for your response. This is what I needed. But I am very new to > cakePHP, i have tried implementing the afterSave() function but it adds a > new record to the other model I want to update. Here is the code, coudl you > please tell me what I am doing wrong: > > function afterSave($created){ > if($created){ > $diary_id = $this_id; > $projects = > > $this->Project->find('all',array('conditions'=>array('Project.id'=>$diary_id))); > $price_worked = $this->price_worked; > $price_left = $projects['Project']['price_left'] - > $price_worked; > $this->Project->save($projects); > } > } > > Kind Regards > Thank you > -- > View this message in context: > http://cakephp.1045679.n5.nabble.com/Saving-to-one-model-while-updating-another-tp3301880p3302988.html > Sent from the CakePHP mailing list archive at Nabble.com. > > 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 [email protected] > To unsubscribe from this group, send email to > [email protected]<cake-php%[email protected]>For > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > 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 [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?hl=en
