[Flow] \DateTimeConverter
mario chiari
ml at mariochiari.net
Sun Jun 2 21:23:32 CEST 2013
Hi,
I have a problem on how to use \DateTimeConverter for my settings.
I have a Father/Son situations, and my New form let a user to define
multiple Father, each with multiple Sons.
Hence, my createAction() needs to be defined something like:
public function createAction(array $newFather) {
$propertyMapper = new \TYPO3\Flow\Property\PropertyMapper();
foreach($newFather as $id => $father){
$fatherObj = $propertyMapper->convert($father,'\...\Model
\Father');
$this->fatherRepository->add($fatherObj);
}
Everything works fine. Now, the Father model has a \DateTime property
and I would like to use a simple d-m-Y date format; I learnt from some
other post how to do so by a initializeCreateAction(), if an array is
not involved:
public function initializeCreateAction() {
$this->arguments['newFather']
->getPropertyMappingConfiguration()
->forProperty('my_date')
->setTypeConverterOption('TYPO3\Flow\Property\TypeConverter
\DateTimeConverter', \TYPO3\Flow\Property\TypeConverter
\DateTimeConverter::CONFIGURATION_DATE_FORMAT,'Y-m-d');}
But how do I fit a similar trick to my settings?
Thanks
Cheers
mario
More information about the Flow
mailing list