/** * Converts a value from its database representation to its PHP representation * * @param mixed $value The value to convert * @param AbstractPlatform $platform The currently used database platform * * @return mixed * * @throws ConversionException When the conversion fails */ public function convertToPHPValue($value, AbstractPlatform $platform) { if (empty($value)) { return null; } if ($value instanceof Date) { return $value; } try { $date = Date::fromString($value); } catch (Exception $exception) { throw ConversionException::conversionFailed($value, static::TYPE_NAME); } return $date; }
/** * @expectedException \Novuso\System\Exception\DomainException */ public function test_that_from_string_throws_exception_for_invalid_format() { Date::fromString('06-20-2015'); }