On Tue, Oct 5, 2010 at 2:51 PM, rj <[email protected]> wrote:
> Hello,
> I have a single form to edit multiple records. Saving the form updates
> all selected records (using "updateAll"), e.g.
> id value
> 1 abc
> 2 NULL
> 3 def
>
> becomes
> 1 xyz
> 2 xyz
> 3 xyz
> when the new value "xyz" is submitted via this form.
>
> So far so good, but now I need to change that behaviour and append the
> values rather than update/replace. I need to achieve this:
> 1 abc, xyz
> 2 xyz
> 3 def, xyz
>
> The appropriate MySQL would be:
>  update table set value = concat(value,'xyz')
>
> So far I don't see any other solution but a custom query and a loop
> through the record ids. Is there something Cakier I could do? Thanks
> for any hints,

I don't think there's getting around using a loop, aside from using
Set class, perhaps. Upon submission, do another find to get the
original values and concat them with the new data.

One suggestion I have is to make this action append() rather than
edit() just so things remain clear.

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

Reply via email to