Commit a5eebd7
authored
Adds ?integer, ?double, ?string, etc. cast types :)
Adds new cast types which are casting only if value !== null
i.e. I've got an nullable col in my dbtable which stores strings (empty or not) and I'd like to have possibility to determine if string is null or '';
Now I cannot when I define casting as a string. with this PR if I define ?string in
```
protected $_options = [
'casts' => [
'usr_id' => 'integer',
'usr_usp_id' => 'integer',
'usr_provider_id' => 'string',
'usr_exc_id' => 'integer',
'usr_drs_id' => 'integer',
'usr_dlc_id' => '?string',
'usr_tzo_id' => 'integer',
'usr_email' => 'string',
'usr_password' => 'string',
'usr_first_name' => 'string',
'usr_last_name' => 'string',
'usr_nick_name' => 'string',
'usr_is_active' => 'boolean',
'usr_is_blocked' => 'boolean',
'usr_is_picture' => 'boolean',
],
'dates'=> ['usr_created_at', 'usr_updated_at'],
'datamap' => []
];
```
I will get NULL or '' for usr_dlc_id according to database value.1 parent b8bbadd commit a5eebd7
1 file changed
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
421 | 421 | | |
422 | 422 | | |
423 | 423 | | |
| 424 | + | |
| 425 | + | |
424 | 426 | | |
425 | 427 | | |
426 | 428 | | |
| |||
0 commit comments