TYPO3
7.6
|
Public Member Functions | |
canConvertFrom ($source, $targetType) | |
convertFrom ($source, $targetType, array $convertedChildProperties=array(),\TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface $configuration=null) | |
Public Member Functions inherited from AbstractTypeConverter | |
injectObjectManager (\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager) | |
getSupportedSourceTypes () | |
getSupportedTargetType () | |
getTargetTypeForSource ($source, $originalTargetType,\TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface $configuration=null) | |
getPriority () | |
canConvertFrom ($source, $targetType) | |
getSourceChildPropertiesToBeConverted ($source) | |
getTypeOfChildProperty ($targetType, $propertyName,\TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface $configuration) | |
Public Member Functions inherited from TypeConverterInterface | |
getTargetTypeForSource ($source, $originalTargetType, PropertyMappingConfigurationInterface $configuration=null) | |
Public Attributes | |
const | CONFIGURATION_DATE_FORMAT = 'dateFormat' |
const | DEFAULT_DATE_FORMAT = \DateTime::W3C |
Protected Member Functions | |
isDatePartKeysProvided (array $source) | |
getDefaultDateFormat (\TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface $configuration=null) | |
overrideTimeIfSpecified (\DateTime $date, array $source) | |
Protected Attributes | |
$sourceTypes = array('string', 'integer', 'array') | |
$targetType = 'DateTime' | |
$priority = 1 | |
Protected Attributes inherited from AbstractTypeConverter | |
$sourceTypes = array() | |
$targetType = '' | |
$priority | |
$objectManager | |
Converter which transforms from different input formats into DateTime objects.
Source can be either a string or an array. The date string is expected to be formatted according to DEFAULT_DATE_FORMAT.
But the default date format can be overridden in the initialize*Action() method like this::
$this->arguments['<argumentName>'] ->getPropertyMappingConfiguration() ->forProperty('<propertyName>') // this line can be skipped in order to specify the format for all properties ->setTypeConverterOption(::class, ::CONFIGURATION_DATE_FORMAT, '<dateFormat>');
If the source is of type array, it is possible to override the format in the source::
array( 'date' => '<dateString>', 'dateFormat' => '<dateFormat>' );
By using an array as source you can also override time and timezone of the created DateTime object::
array( 'date' => '<dateString>', 'hour' => '<hour>', // integer 'minute' => '<minute>', // integer 'seconds' => '<seconds>', // integer 'timezone' => '<timezone>', // string, see http://www.php.net/manual/timezones.php );
As an alternative to providing the date as string, you might supply day, month and year as array items each::
array( 'day' => '<day>', // integer 'month' => '<month>', // integer 'year' => '<year>', // integer );
Definition at line 63 of file DateTimeConverter.php.
canConvertFrom | ( | $source, | |
$targetType | |||
) |
If conversion is possible.
string | $source | |
string | $targetType |
Implements TypeConverterInterface.
Definition at line 100 of file DateTimeConverter.php.
References DateTimeConverter\$targetType.
convertFrom | ( | $source, | |
$targetType, | |||
array | $convertedChildProperties = array() , |
||
\TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface | $configuration = null |
||
) |
Converts $source to a using the configured dateFormat
string | int | array | $source | the string to be converted to a object |
string | $targetType | must be "DateTime" |
array | $convertedChildProperties | not used currently |
\TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface | $configuration |
\TYPO3\CMS\Extbase\Property\Exception\TypeConverterException |
Implements TypeConverterInterface.
Definition at line 124 of file DateTimeConverter.php.
References elseif, DateTimeConverter\getDefaultDateFormat(), DateTimeConverter\isDatePartKeysProvided(), and DateTimeConverter\overrideTimeIfSpecified().
|
protected |
Determines the default date format to use for the conversion. If no format is specified in the mapping configuration DEFAULT_DATE_FORMAT is used.
\TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface | $configuration |
\TYPO3\CMS\Extbase\Property\Exception\InvalidPropertyMappingConfigurationException |
Definition at line 194 of file DateTimeConverter.php.
References elseif.
Referenced by DateTimeConverter\convertFrom().
|
protected |
Returns whether date information (day, month, year) are present as keys in $source.
array | $source |
Definition at line 179 of file DateTimeConverter.php.
Referenced by DateTimeConverter\convertFrom().
|
protected |
Overrides hour, minute & second of the given date with the values in the $source array
\DateTime | $date | |
array | $source |
Definition at line 215 of file DateTimeConverter.php.
Referenced by DateTimeConverter\convertFrom().
|
protected |
Definition at line 91 of file DateTimeConverter.php.
|
protected |
Definition at line 81 of file DateTimeConverter.php.
|
protected |
Definition at line 86 of file DateTimeConverter.php.
Referenced by DateTimeConverter\canConvertFrom().
const CONFIGURATION_DATE_FORMAT = 'dateFormat' |
Definition at line 68 of file DateTimeConverter.php.
const DEFAULT_DATE_FORMAT = \DateTime::W3C |
Definition at line 76 of file DateTimeConverter.php.