![]() |
Datamapper ORM - Deep Relationship with AES_encrypted fields in mySQL - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Datamapper ORM - Deep Relationship with AES_encrypted fields in mySQL (/showthread.php?tid=48002) |
Datamapper ORM - Deep Relationship with AES_encrypted fields in mySQL - El Forum - 12-31-2011 [eluser]Unknown[/eluser] Hi All, If I've got the following setup... Users (aes encrypted fields) Documents Document Revisions A Document can have many Document Revisions A Document Revision has one user that uploaded it (stored as user_id) I need to encrypt the fields in the users table using aes_encrypt and decode them using aes_decrypt via mySQL. Which works fine for the user model as I can add in the select query to do the decode functions. But what if I want to return the deep relationship, from the Document object, and decrypt the users firstname, lastname and emailaddress fields. Code: $document = new Document; I'm currently doing the above, and then doing a foreach in the view... (I've removed the HTML inbetween the PHP tags for this demo. Code: foreach ($revisions as $k=>$revision){ So how do I get my user->firstname response to produce the decrypted aes field instead of the raw string from the DB which is a bunch of characters. Thanks, Jason |