class DateIntervalToArrayTransformer implements DataTransformerInterface

Transforms between a normalized date interval and an interval string/array.

Constants

YEARS

MONTHS

DAYS

HOURS

MINUTES

SECONDS

INVERT

Methods

__construct(array $fields = null, bool $pad = false)

No description

mixed
transform(DateInterval $dateInterval)

Transforms a normalized date interval into an interval array.

mixed
reverseTransform(mixed $value)

Transforms an interval array into a normalized date interval.

Details

at line 49
__construct(array $fields = null, bool $pad = false)

Parameters

array $fields The date fields
bool $pad Whether to use padding

at line 67
mixed transform(DateInterval $dateInterval)

Transforms a normalized date interval into an interval array.

Parameters

DateInterval $dateInterval Normalized date interval

Return Value

mixed The value in the transformed representation

Exceptions

UnexpectedTypeException if the given value is not a \DateInterval instance

at line 114
mixed reverseTransform(mixed $value)

Transforms an interval array into a normalized date interval.

Parameters

mixed $value The value in the transformed representation

Return Value

mixed The value in the original representation

Exceptions

UnexpectedTypeException if the given value is not an array
TransformationFailedException if the value could not be transformed