DateIntervalToArrayTransformer
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) | |
| 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
__construct(array $fields = null, bool $pad = false)
Parameters
| array | $fields | The date fields |
| bool | $pad | Whether to use padding |
Transforms a normalized date interval into an interval array.
Parameters
Return Value
| mixed | The value in the transformed representation |
Exceptions
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