Project

General

Profile

Actions

Bug #82847

open

extbase model object validation does not care for overwritten classes

Added by Michael Grundkötter about 7 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2017-10-24
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When adding features to an exisiting extension by overwriting e.g. model classes via

$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['Mittwald\Typo3Forum\Domain\Model\Forum\Post'] = array(
    'className' => 'xyz\xyz\Domain\Model\Forum\Post'
);

the ValidatorResolver / ReflectionService does obviously not take the overwritten class as base for the reflection but the original one which is given in the original controller code as annotation and class hint like here:
    /**
     * Creates a new post.
     *
     * @param Topic $topic The topic in which the new post is to be created.
     * @param Post $post The new post.
     * @param array $attachments File attachments for the post.
     *
     * @validate $post \Mittwald\Typo3Forum\Domain\Validator\Forum\PostValidator
     * @validate $attachments \Mittwald\Typo3Forum\Domain\Validator\Forum\AttachmentPlainValidator
     */

    public function createAction(Topic $topic, Post $post, array $attachments = []) {

Thus, all the @validate annotations in the new class as well as the model class validators in Classes/Domain/Validator directory are ignored. Right now, this forces the developer to also overwrite the controller classes and change the type hints to the original model class which is unnecessary work, as extbase already "knows" about the new child classes when the ObjectManager is used to instantiate the original model class.


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Bug #78394: Property and object validators of child classes in STI are ignoredNew2016-10-24

Actions
Actions

Also available in: Atom PDF