Skip to content

Commit e675a4d

Browse files
authored
Update Entity.php
1 parent a5eebd7 commit e675a4d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

system/Entity.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ protected function mutateDate($value)
412412

413413
/**
414414
* Provides the ability to cast an item as a specific data type.
415+
* Add ? at the beginning of $type (i.e. ?string) to get NULL instead of castig $value if $value === null
415416
*
416417
* @param $value
417418
* @param string $type
@@ -426,6 +427,7 @@ protected function castAs($value, string $type)
426427
switch($type)
427428
{
428429
case 'integer':
430+
case 'int': //alias for 'integer'
429431
$value = (int)$value;
430432
break;
431433
case 'float':
@@ -438,6 +440,7 @@ protected function castAs($value, string $type)
438440
$value = (string)$value;
439441
break;
440442
case 'boolean':
443+
case 'bool': //alias for 'boolean'
441444
$value = (bool)$value;
442445
break;
443446
case 'object':

0 commit comments

Comments
 (0)