Project

General

Profile

Actions

Bug #98190

open

Extbase fails to resolve chained validations

Added by Oliver Hader over 1 year ago. Updated 11 months ago.

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.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #98148: Extbase persistence erronously tries to persist unmapped private property Closed2022-08-16

Actions
Actions #1

Updated by Oliver Hader over 1 year ago

  • Related to Bug #98148: Extbase persistence erronously tries to persist unmapped private property added
Actions #2

Updated by Oliver Hader over 1 year ago

  • Status changed from New to Accepted
Actions #3

Updated by Benni Mack 11 months ago

  • Sprint Focus set to Stabilization Sprint
Actions

Also available in: Atom PDF