If anybody is interested in that thread, solution 1 and 2 proposed by
Nate don't work because merging two arrays recursively returns
something like this;

[code]
Array
(
    [Article] => Array
        (
            [id] => Array
                (
                    [0] => 1
                    [1] => 1
                )
            [title] => Array
                (
                    [0] => This is some MODIFIED title
                    [1] => This is some title
[/code]

The last solution does work, but requires a fair bit of time to
implement and make creating a new virtual field a pain.

I'll keep looking into it!

Cheers,

Seb.



On Jan 22, 4:51 pm, "nate" <[EMAIL PROTECTED]> wrote:
> Sorry, didn't see you the first time.  Okay, as I see it, there are 4
> ways to solve your problem, 3 of which are basically variations on the
> same theme.  The first three ways are these:
>
> // Controller: re-query your entire User model, and merge it with
> $this->data:
> $this->data = array_merge_recursive($this->User->findById($id),
> $this->data);
>
> // Controller: slightly optimized version of the above:
> $user = list($this->User->findById($id, array('relevant', 'fields',
> 'only')));
> $this->data['User']['name_if'] = $user['name_if'];
>
> // Controller: just re-query and blow away the POST data completely:
> $this->data = $this->User->findById($id);
>
> And the final solution is view based:
> // Add a hidden field for the virtual field, to persist it across
> pages:
> <?=$form->hidden("User/name_if"); ?>
>
> - Nate
>   "You know my name, Google the number."


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to