Actions
Bug #98190
openExtbase fails to resolve chained validations
Status:
Accepted
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
Stabilization Sprint
Description
use TYPO3\CMS\Extbase\Annotation\Validate; class Parent extends AbstractEntity { protected Child $child; } class Child extends AbstractEntity { /** * @Validate("StringLength", options={"minimum": 1, "maximum": 80}) */ public string $title = ''; } class ParentController extends ActionController { public function showAction(Parent $parent): ResponseInterface { // ... } }
Action Parent.show
gets argument of type Parent
, which has a non-accessible property to type Child
, which has a validation rule of a property. Following the validation chain is correct in general, unless some part of it cannot be accessed (which is protected property Parent::$child
in this example).
The result is a corresponding exception:
(1/1) #1546632293 RuntimeException Could not get value of property "Olly\Model\Domain\Model\Parent::child", make sure the property is either public or has a getter getChild(), a hasser hasChild() or an isser isChild().
In case validation for internal values is desired/expected, this probably would be something for reflection.
In case developers would "need to adjust their code", current RuntimeException
(#1546632293
) is semantically wrong, it has to be a LogicException
instead.
Updated by Oliver Hader about 2 years ago
- Related to Bug #98148: Extbase persistence erronously tries to persist unmapped private property added
Actions