I am fairly certain that each related model will take care of it's own 
beforeSave and afterFind callbacks, so you should just need to handle 
encryption/decryption for the primary model, and each other model that is 
saved/found will handle its own as well.

Cheers,
Adam

----- Original Message ----- 
From: "BrendonKoz" <brendon...@hotmail.com>
To: "CakePHP" <cake-php@googlegroups.com>
Sent: Wednesday, June 17, 2009 6:55 AM
Subject: Advanced(?) Behavior question


>
> I've been writing an encryption/decryption behavior that will
> automatically encrypt and decrypt model data on-the-fly, according to
> settings defined for the behavior (per model) within the model.
>
> I have it working for DEEP finds (set recursive to 5 just to test) on
> all fields for the current model that should be decrypted within the
> returned result array from afterFind.
>
> My question is...(this would be an option)...if I wanted to decrypt
> ALL fields for ALL models that utilize the encryption behavior
> regardless of which model is requesting the data - what would be the
> best way to approach this?
>
> Within my behavior's code, I'm able to tell which model I'm currently
> in (which fields in the non-primary query belong to which model), but
> would I have to instantiate all found models (each time? - I hope not)
> other than the current model in order to determine which fields are
> supposed to be encrypted/decrypted?  Although I took an example page
> from the Cipher Behavior in having a prefix on the field data to
> determine whether a field is encrypted or not, since it's something
> that can be changed per database, I can't necessarily rely on it to be
> the same for ALL fields within the resultant array from the find
> query.
>
> Any ideas?
> >
>
> 


--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to