Tuesday, October 27, 2009

Manipulating data fields with different array structure in model callback methods

I am trying to look for a generic way to manipulate model data, say, in
beforeValidate in model. The model data could be in different array
structure (or shape). For example, the field to be validated can be in the
following 5 cases (and possibly more):

array['ModelName'][0]['field']
array[0]['ModelName'][field']
array['ModelName']['field']
array['ParentModelName']['ModelName']['field']
array['ParentModelName'][0]['ModelName']['field']

Is there a generic "cake" way to handle this, or I have to make a if-else
condition to go through all the possible scenarios case by case?

Thanks!
--Lapinski

--
View this message in context: http://www.nabble.com/Manipulating-data-fields-with-different-array-structure-in-model-callback-methods-tp26078723p26078723.html
Sent from the CakePHP mailing list archive at Nabble.com.


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