On Thursday, October 11, 2012 10:53:07 PM UTC+7, [email protected] 
wrote:
>
> For 2.x sites you can also set 'unique' => 'keepExisting' to prevent the 
> save from deleting existing records:
>

Yes.

However, you will still need to ensure that those data exist on the form 
(which might not be required).

For example: User habtm Role.
When updating a User address, you still need to provide the Role data in 
the POSTed array.  To avoid the need
of providing the Role data, you could temporarily unbind the relationship 
using unbindModel() before the call to User->save().

 

>
>
> http://book.cakephp.org/2.0/en/models/saving-your-data.html#what-to-do-when-habtm-becomes-complicated
>
> http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#ref-habtm-arrays
>
> Keith Gorman
> *Class Outfit*
> **
> www.classoutfit.com
>  
> On 11 Oct 2012, at 08:15, Jeremy Burns | Class Outfit <
> [email protected] <javascript:>> wrote:
>
> By default, Cake clears down the entire habtm table (for the current 
> association) and adds back in just those that are in the current saved 
> dataset. So if a cart has three orders and you try to add another in 
> isolation the first three are cleared and replaced with the new one. If you 
> are trying to add just a new cart_order and want to preserve the existing 
> ones you are best off creating a model for the habtm table and managing it 
> just as you would any other model.
>
> Jeremy Burns
> Class Outfit
>
> http://www.classoutfit.com 
>
> On 10 Oct 2012, at 22:03:26, crush <[email protected] <javascript:>> wrote:
>
> Hey,
> I have an orders table, a carts table and a carts_orders table. Every once 
> and a while, I lose some of the rows from the carts_orders table. They are 
> being created properly but are being deleted at some point. I have been 
> trying to figure it out but everything in the applications works 99.9 
> percent of the time and it's very difficult to nail down exactly what's 
> happening. 
>
> My questions is: *What CakePHP methods would cause those rows to be 
> deleted, but not the associated entries in the carts and orders tables*?
>
> Any help would be appreciated!
>
> -- 
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>  
> --- 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to [email protected]<javascript:>
> .
> To unsubscribe from this group, send email to 
> [email protected] <javascript:>.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>  
>  
>
>
>
> -- 
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>  
> --- 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to [email protected]<javascript:>
> .
> To unsubscribe from this group, send email to 
> [email protected] <javascript:>.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>  
>  
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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].
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply via email to