Bug #27806

DateTimeConverter should return Error objects for user-errors; and support converting an empty string to NULL

Added by Michael Klapper about 10 years ago. Updated about 10 years ago.

Status:
Resolved
Priority:
Should have
Category:
Property
Start date:
2011-07-02
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Complexity:

Description

Returning Error objects

The TYPO3\FLOW3\Property\TypeConverter\DateTimeConverter should return an \TYPO3\FLOW3\Error\Error instead of throwing an \TYPO3\FLOW3\Property\Exception\TypeConverterException.

The advantage of this change is the much better handling of form convertion/validation error messages. The messages are stored as "validationResults" in $this->arguments of the current ActionController.

Displaying the messages could be easily done with the Fluid ViewHelper f:form.validationResults.

Support "empty" DateTime -> Convert to NULL

Right now, the DateTimeConverter is required, i.e. it is not possible to define an optional DateTime object.

When the DateTime converter returns NULL for the empty string, one can use "@validate NotEmpty" for required properties.

#1

Updated by Robert Lemke about 10 years ago

  • Category set to Property
  • Assignee set to Sebastian Kurfuerst
  • Target version set to 1230
#2

Updated by Sebastian Kurfuerst about 10 years ago

  • Status changed from New to Accepted
  • Target version changed from 1230 to 1.0 beta 2
#3

Updated by Sebastian Kurfuerst about 10 years ago

  • Subject changed from DateTimeConverter should return an Error instead of throwing Exceptions to DateTimeConverter should return Error objects for user-errors; and support converting an empty string to NULL

Hey Michael,

sorry for hijacking the description; I extended it a bit - and will work on a fix now.

Greets,
Sebastian

#4

Updated by Mr. Hudson about 10 years ago

  • Status changed from Accepted to Under Review

Patch set 1 of change Ie95602c44e9d86586353514cbde2cd06259f3b30 has been pushed to the review server.
It is available at http://review.typo3.org/4786

#5

Updated by Mr. Hudson about 10 years ago

Patch set 2 of change Ie95602c44e9d86586353514cbde2cd06259f3b30 has been pushed to the review server.
It is available at http://review.typo3.org/4786

#6

Updated by Sebastian Kurfuerst about 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF