Monday, November 2, 2009

Re: Saving array with same information

Why not normalise the database, and simply move the dates to a new
EventDate model?

Event hasMany EventDate

I don't see why in this case you would purposefully populate the table
with redundant data.

On Nov 2, 6:22 pm, Octavian <octaviansus...@gmail.com> wrote:
> Hi,
>
> I'm trying to add new events. An event can have more than one date,
> but always has the same name/description. So this same info is only
> entered once in the add form, but dates can be added dynamically to
> the form. Controller should insert for each date a new event with a
> different date but the same info.
>
> My array looks like this:
>
> Array
> (
>     [Event] => Array
>         (
>             [0] => Array
>                 (
>                     [date] => Array
>                         (
>                             [month] => 11
>                             [day] => 09
>                             [year] => 2009
>                         )
>
>                     [name] => The 80s party
>                     [description] => With secial guests
>                     [website_url] => eightiesparty.com
>                 )
>
>             [1] => Array
>                 (
>                     [date] => Array
>                         (
>                             [month] => 11
>                             [day] => 12
>                             [year] => 2009
>                         )
>
>                 )
>
>         )
>
> )
>
> How can I loop through the rows 0 and 1 and insert the info (name,
> description, websiteurl) from 0 to 1?
>
> Thanks :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: