PHP 클래스 Neos\Flow\Property\TypeConverter\DateTimeConverter

For integers the default is to treat them as a unix timestamp. If a format to cerate from is given, this will be used instead. If source is a string it is expected to be formatted according to DEFAULT_DATE_FORMAT. This default date format can be overridden in the initialize*Action() method like this:: $this->arguments[''] ->getPropertyMappingConfiguration() ->forProperty('') // this line can be skipped in order to specify the format for all properties ->setTypeConverterOption(\Neos\Flow\Property\TypeConverter\DateTimeConverter::class, \Neos\Flow\Property\TypeConverter\DateTimeConverter::CONFIGURATION_DATE_FORMAT, ''); If the source is of type array, it is possible to override the format in the source:: array( 'date' => '', 'dateFormat' => '' ); By using an array as source you can also override time and timezone of the created DateTime object:: array( 'date' => '', 'hour' => '', // integer 'minute' => '', // integer 'seconds' => '', // integer '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' => '', // integer 'month' => '', // integer 'year' => '', // integer );
상속: extends AbstractTypeConverter
파일 보기 프로젝트 열기: neos/flow-development-collection 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$priority integer
$sourceTypes array
$targetType string

공개 메소드들

메소드 설명
canConvertFrom ( string $source, string $targetType ) : boolean If conversion is possible.
convertFrom ( string | integer | array $source, string $targetType, array $convertedChildProperties = [], Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : DateTime | Error Converts $source to a \DateTime using the configured dateFormat

보호된 메소드들

메소드 설명
getDefaultDateFormat ( Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : string Determines the default date format to use for the conversion.
isDatePartKeysProvided ( array $source ) : boolean Returns whether date information (day, month, year) are present as keys in $source.
overrideTimeIfSpecified ( DateTime $date, array $source ) : void Overrides hour, minute & second of the given date with the values in the $source array

메소드 상세

canConvertFrom() 공개 메소드

If conversion is possible.
public canConvertFrom ( string $source, string $targetType ) : boolean
$source string
$targetType string
리턴 boolean

convertFrom() 공개 메소드

Converts $source to a \DateTime using the configured dateFormat
public convertFrom ( string | integer | array $source, string $targetType, array $convertedChildProperties = [], Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : DateTime | Error
$source string | integer | array the string to be converted to a \DateTime object
$targetType string must be "DateTime"
$convertedChildProperties array not used currently
$configuration Neos\Flow\Property\PropertyMappingConfigurationInterface
리턴 DateTime | Neos\Flow\Validation\Error

getDefaultDateFormat() 보호된 메소드

If no format is specified in the mapping configuration DEFAULT_DATE_FORMAT is used.
protected getDefaultDateFormat ( Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : string
$configuration Neos\Flow\Property\PropertyMappingConfigurationInterface
리턴 string

isDatePartKeysProvided() 보호된 메소드

Returns whether date information (day, month, year) are present as keys in $source.
protected isDatePartKeysProvided ( array $source ) : boolean
$source array
리턴 boolean

overrideTimeIfSpecified() 보호된 메소드

Overrides hour, minute & second of the given date with the values in the $source array
protected overrideTimeIfSpecified ( DateTime $date, array $source ) : void
$date DateTime
$source array
리턴 void

프로퍼티 상세

$priority 보호되어 있는 프로퍼티

protected int $priority
리턴 integer

$sourceTypes 보호되어 있는 프로퍼티

protected array $sourceTypes
리턴 array

$targetType 보호되어 있는 프로퍼티

protected string $targetType
리턴 string