CodeIgniter Forums
CI Model with set() option to escape - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29)
+--- Thread: CI Model with set() option to escape (/showthread.php?tid=77062)



CI Model with set() option to escape - ogomez - 07-16-2020

Is it possible to add the set method to the CI Model which allows you to set escape to false?

I would like to be able to use MySQL functions for example UTC_TIMESTAMP() but it's not possible without the set and escape options.

PHP Code:
$data = [
    
'id'       => 3,
    
'username' => 'darth',
    
'email'    => '[email protected]'
];

$userModel->set('datetime''UTC_TIMESTAMP()'false)->save($data); 

Thanks in advance


RE: CI Model with set() option to escape - ericnagel - 08-13-2020

Not really the answer you're looking for, but I've either fallen back to a PHP function to get the value I want to insert or use the Query Builder.