Monday, May 4, 2009

best place to code this??

Hello.

i have a view that returns a data array like this

Array(
[Order] => array(
[Code] => XXX
[Customer] => 5
)
[Items] => array(
[0] => array(
[Code] => Item1
[Quantity] => 3
)
[1] => array(
[Code] => Item2
[Quantity] => 2
)
)
)

i must convert this format to:

Array(
[Order] => array(
[Code] => XXX
[Customer] => 5
)
[Items] => array(
[0] => array(
[Code] => Item1
)
[1] => array(
[Code] => Item1
)
[2] => array(
[Code] => Item1
)
[3] => array(
[Code] => Item2
)
[4] => array(
[Code] => Item2
)
)
)

the resulting array will be saved with a saveAll();

Item::validate array is intended to work with the 2nd array

where's best (and most MVC-style) place to do that???

- directly in OrdersController::add
- Order::beforeValidate
- Order::beforeSave

???

sry for my bad english

--~--~---------~--~----~------------~-------~--~----~
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: