[FLOW3-general] DateTime and FLUID-Form

Mathis Hoffmann mathis at hoffpost.de
Sat Aug 27 11:15:10 CEST 2011


Hello,

I have problems using a FLUID-Form with a text-field where the user
could enter a date (like 13.10.2011) plus two simple string-fields
(name & title). I have a model \Plan\Domain\Model\Entry with the
attribute \DateTime $date. The FLUID-Form sends data to a createAction
in my StandardController, which expects an object of the type
\Plan\Domain\Model\Entry. When I submit the form FLOW3 tells me about
problems with the PropertyMapper. Therefore I changed the object-type
which createAction expects to
\Doctrine\Common\Collections\ArrayCollection an tried to handle the
request using the propertyMappingConfigurationBuilder with the
following configuration:

	/**
	 * Create action
	 *
	 * @param \Doctrine\Common\Collections\ArrayCollection $newEvent The new event
	 * @return void
	 */
	public function createAction($newEvent) {
		$conf = $this->propertyMappingConfigurationBuilder->build();
		$conf->forProperty('date');
		$conf->setTypeConverterOption('TYPO3\FLOW3\Property\TypeConverter\DateTimeConverter',
								\TYPO3\FLOW3\Property\TypeConverter\DateTimeConverter::CONFIGURATION_DATE_FORMAT,
								'd.m.Y');
		$newEvent = $this->propertyMapper->convert($newEvent,
'Plan\Domain\Model\Event', $conf);
		$this->eventRepository->add($newEvent);
		$this->redirect('index');
	}

This ends up in #1297759968: Exception while property mapping at
property path "title":The target type was no string, but of type
"NULL". So my question is: What is the simpliest way to handle such a
date-input in combination with other form-fields?

Thanks in advance for any suggestion!

Greetings from Germany
Mathis Hoffmann


More information about the FLOW3-general mailing list