Bug #89684

PropertyMapper will throw exception on validating classes without a constructor

Added by Christian Eßl 2 months ago. Updated 12 days ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2019-11-14
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

If DTO class is used in a form, that has no constructor (and does not inherit from "AbstractEntity") and a property is missing (because the developer forgot to add it to the class), the property mapper will not show meaningfull errors about the property but instead throw the following exception:

#1297759968: Exception while property mapping at property path "": Method Cyberhouse\ExtensionName\Domain\Dto\TestForm::__construct() does not exist

In case a property is missing, the PropertyMapper automatically expects the class to have a constructor when handling the error. If all properties are present in the class, everything works fine without a constructor (submitting forms, validating, etc.), so I will treat this as a bug in the PropertyMapper.

History

#1 Updated by Christian Eßl 27 days ago

Appears to be longer the case in TYPO3 10.3.

Now you will get a much more meaningful error on implementation errors like:

Exception while property mapping at property path "": Property "firstName" had no setter or constructor argument in target object of type "Cyberhouse\ ExtensionName\Domain\Dto\ TestForm".

It looks like a constructor is no longer mandatory on objects validated by the PropertyMapper.
So this ticket can be closed.

#2 Updated by Alexander Schnitzler 12 days ago

  • Status changed from New to Closed

Glad I could help. :P

Also available in: Atom PDF