Hello all,
I am in need for some enlightment :)
At the moment I have an Image model which is associated with an
ImageType model.
So an lmage has a image_type_id.
In my Image model I'd like to dispatch the images that each query on
the model returns based on the image type.
I am currently doing it in afterFind model callback but :
Since the results that I use in the afterFind callback are of
different formats depending on which type of operation I am doing
(read, find, find that part of a recursive find ...), I end up
branching the logic to make up for the differrent cases like so :
if(isset($data['Image']['id'])) {//READ OPERATION
else if(isset($data[0]['Image']['id'])) {//FIND OPERATION
if(isset($data[0]['Image'][0]['id'])) {//data from an association
after find
if(isset($data[0]['id'])) {//data from a deep association after find
but to be honest I think I am missing something here and that I even
can't be sure I am covering all the cases regarding the format of the
result array. I am also thinking there is a better way ...
So first :
Do I make sense at all ?
second :
any help or insight really appreciated
tia
thomas
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---