brian, I'd be quite grateful if you could remember or find that
Behavior.  :)  I'm not really sure how to progress forward here,
unfortunately.  I understand it'd be a performance hit (I'm also not
sure how much), but that would be why I'd make it optional in the
behavior's settings (per model).

On Jun 17, 1:23 am, brian <[email protected]> wrote:
> Model::find() only triggers Behavior callbacks on the main model, not
> those associated with it. However, I'm certain that I've seen at least
> one Behavior that got around that by running through its Model's
> associations and, for those that implemented the same Behavior, did
> its thing (whatever it was).
>
> I've no idea how much of a performance hit that would incur, though.
>
> On Tue, Jun 16, 2009 at 11:09 PM, Brendon Kozlowski
>
> (Realm)<[email protected]> wrote:
>
> > That's what I was hoping too. Unfortunately that didn't seem to be the
> > case.
>
> > I did a users/posts/comments example site to test functionality.
> > User's email address was encrypted in the DB, and when viewing the
> > index page, it was decrypted (working for user model). Post's title
> > was encrypted (just a test) and I created a method "testDecrypt" in
> > the Post model...all it did was a find('all') with recursive set to 3.
> > I then pr()'d the result and used die() to stop operation. All post
> > titles were decrypted (they were encrypted in the database) but the
> > user emails showed up as encrypted.
>
> > On Jun 16, 9:24 pm, "Adam Royle" <[email protected]> wrote:
> >> 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" <[email protected]>
> >> To: "CakePHP" <[email protected]>
> >> 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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to