php - Decrypt and Encrypt using CallBack Methods in cakephp -
i want use callbacks methods encrypt value before gets stored in database , decrypt before showing in application. i used 1 of examples provided in documentation . in core.php put following : configure::write('security.ciphercriptkey','su0hksspmdbwgk6ldqlqzp0ymyati7zo'); in model, used 2 methods: beforesave() public function beforesave($options = array()) { $value=$this->data['internship']['encryptedindb']; $encrypted = security::encrypt($value, configure::read('security.ciphercriptkey')); $this->data['internship']['encryptedindb'] = $encrypted; return true; } afterfind() public function afterfind($results, $primary = false) { foreach ($results $key => $val) { if(isset($val['internship']['encryptedindb'])){ $results['internship']['encryptedindb'] = security::decrypt($val['internship']['encryptedindb']...