Re: Can cakephp do association save? Please help...
I have seen transaction support while mulling around the CakePHP code the other day. Do a codebase search for transaction and something should appear. Not sure if it was the lastest trunk or the latest ver2.0 trunk that I saw it in. Also, I doubt since you don't know about it (you seem up on things ad7six) that it is really released as a function. But something is in there for it. As for the multiple saves turn on debugging and see what you find out. I had a hard time with it and the can't delete this with that so instead of figuring out MySQL relations I just manage each object sepeartely as ad7six suggested. --~--~-~--~~~---~--~~ 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: Can cakephp do association save? Please help...
Hi Amir, Multiple saves: I'm pretty sure the answer is that you will need to save each object individually - if you set Debug to 2 and try it yourself, you'll see the generated SQL and therefore have you answer, at the foot of the page after you save. Transactions: I don't think there is any support right now, but I'd be glad to be corrected ;o) 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 -~--~~~~--~~--~--~---
Can cakephp do association save? Please help...
Hi... A bit explanations, Let say i have 2 tables, with hasMany association 1. questions, and 2. answers, where it has foreignkey referred to question, question_id This 2 tables ofcourse will turn to 2 models Question and Answer with their association variables set-up. 1. Question has many answer so...in Question model $hasMany = array( 'Answer' => array( 'className' => 'Answer')); 2. Answer belongs to question so..in Answer module $belongsTo = array( 'Question' => array('className' => 'Question')); Then, I have this array of data...both question and answer data. like structure below: Array{ [Question] => ( ..., [Answer] => { [0] =>( ...), [1] =>(), } ) } My question is, 1. Can i save both Question and Answer records using $this->Question->save() ONLY? 2. or do i have to do trigger 2 separate save $this->Question->save and $this->Answer->save? 3. How can do this with transaction like begin, commit and rollback trans? regards Amir --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---