Doctrine - encryption with dql listeners
I am attempting to encrypt certain database fields by adding a call to mysql AES_ENCRYPT
(and AES_DECRYPT
) using Doctrine DQL Hooks.
for SQL SELECT
's I have a preDqlSelect()
in my Doctrine_Record_Li开发者_如何学Gostener
class, which goes through each parameter in the select fields, and adds a AES_DECRYPT()
for encrypted fields.
But, it looks like calling save()
on a doctrine model class only calls the preSave()
listener and does not call any of the preDql* listeners.
Can anyone suggest a way of getting this to work or a better way of doing this?
Thanks
In order for these dql callbacks to be checked, you must explicitly turn them on. Because this adds a small amount of overhead for each query, it is off by default
$manager->setAttribute(Doctrine_Core::ATTR_USE_DQL_CALLBACKS, true);
Doctrine 1.2 Event listeners
精彩评论