CodeIgniter Forums
Auto cast variables to match the datatype defined in the table - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Auto cast variables to match the datatype defined in the table (/showthread.php?tid=85878)



Auto cast variables to match the datatype defined in the table - abatrans - 12-15-2022

Is there a way to automatically cast the return variables, when retrieving a row(s) from a database table, to match the datatype from the table structure without having to use the Entity class? This will apply the models find and findall methods as well as the builders getResults, getRow, getResultArray and getRowArray methods.
Alternately is there a way to allow an entity to be created from a table structure.
Any ideas will be appreciated.