entity/traits/Properties.php
protected function castGetProperty($property, $value)
    {
        if (is_null($value)) {
            return $value;
        }

        switch ($this->getCastType($property)) {
            case 'int':
            case 'integer':
                return (int)$value;
            case 'real':
            case 'float':
            case 'double':
                return (float)$value;
            case 'string':
                return (string)$value;
            case 'bool':
            case 'boolean':
                return (bool)$value;
            case 'boolean_string':
                return ($value == 'true');
            case 'object':
                return json_decode($value, false);
            case 'array':
            case 'json':
                return json_decode($value, true);
            case 'datetime':
                return new \DateTime($value);
            default:
                return $value;
        }
    }
protected function castGetProperty($property, $value)
    {
        if (is_null($value)) {
            return $value;
        }

        switch ($this->getCastType($property)) {
            case 'int':
            case 'integer':
                return (int)$value;
            case 'real':
            case 'float':
            case 'double':
                return (float)$value;
            case 'string':
                return (string)$value;
            case 'bool':
            case 'boolean':
                return (bool)$value;
            case 'boolean_string':
                return ($value == 'true');
            case 'object':
                return json_decode($value, false);
            case 'array':
            case 'json':
                return json_decode($value, true);
            case 'datetime':
                return new \DateTime($value);
            default:
                return $value;
        }
    }
Cast an property to a native PHP type.

@param  string $property
@param  mixed $value
@return mixed