简体   繁体   中英

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_Listener 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM