src/SnooPHP/Model/Model.php
protected function decodeValue($val, $column = "")
	{
		if ($column === static::$idColumn)
			$val = (int)$val;
		else if (isset(static::$casts[$column]))
		{
			switch (static::$casts[$column])
			{
				case "object":
					$val = from_json($val, false);
					break;
				case "array":
					$val = from_json($val, true);
					break;
				default:
					settype($val, static::$casts[$column]);
			}
		}
		/// We leave it for compatibility
		else if (in_array($column, static::$jsons) && is_string($val))
			$val = from_json($val);
		
		return $val;
	}
protected function decodeValue($val, $column = "")
	{
		if ($column === static::$idColumn)
			$val = (int)$val;
		else if (isset(static::$casts[$column]))
		{
			switch (static::$casts[$column])
			{
				case "object":
					$val = from_json($val, false);
					break;
				case "array":
					$val = from_json($val, true);
					break;
				default:
					settype($val, static::$casts[$column]);
			}
		}
		/// We leave it for compatibility
		else if (in_array($column, static::$jsons) && is_string($val))
			$val = from_json($val);
		
		return $val;
	}
Convert value coming from database

@param string	$val	value to convert
@param string	$column	name of the column

@return mixed