Bug #87566

Column configuration can't be overridden by child object

Added by Alexander Schnitzler over 2 years ago. Updated 2 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2019-02-04
Due date:
2019-02-04 (over 2 years late)
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.2
Tags:
Complexity:
medium
Is Regression:
Yes
Sprint Focus:

Description

This one is a bit tricky and best explained by an example.

We have the following configuration:

config.tx_extbase.persistence.classes {
    TYPO3\CMS\Extbase\Domain\Model\BackendUser {
        mapping {
            columns {
                username.mapOnProperty = userName
            }
        }
    }
}

and the following one:

config.tx_extbase.persistence.classes {
    TYPO3\CMS\Beuser\Domain\Model\BackendUser {
        mapping {
            columns {
                username.mapOnProperty = overridden
            }
        }
    }
}

It's important to recognize the following heritage:

TYPO3\CMS\Beuser\Domain\Model\BackendUser extends TYPO3\CMS\Extbase\Domain\Model\BackendUser

The issue:
When a datamap is created, the configuration of the child object TYPO3\CMS\Beuser\Domain\Model\BackendUser gets merged with the one of TYPO3\CMS\Extbase\Domain\Model\BackendUser but in a way that the configuration of the child object does not override the one of the parent.

The property of TYPO3\CMS\Beuser\Domain\Model\BackendUser being mapped on field username should be overridden, instead it's the one of the parent (userName).

However, adding new columns works just fine.


Related issues

Follows TYPO3 Core - Task #87623: Replace config.persistence.classes typoscriptClosed2019-02-02

Actions
#1

Updated by Alexander Schnitzler over 2 years ago

  • Description updated (diff)
#2

Updated by Mathias Brodala 2 months ago

  • Is Regression set to Yes
#3

Updated by Mathias Brodala 2 months ago

  • Due date set to 2019-02-04
  • Start date changed from 2019-01-28 to 2019-02-04
  • Follows Task #87623: Replace config.persistence.classes typoscript added
#4

Updated by Claus Harup 2 months ago

This is working for me in TYPO3 v. 10:

\typo3\sysext\extbase\Classes\Persistence\ClassesConfigurationFactory.php

....
foreach ($relevantParentClasses as $currentClassName) {
  if (null === $properties = $classes[$currentClassName]['properties'] ?? null) {
    continue;
  }

  //ArrayUtility::mergeRecursiveWithOverrule($classes[$className]['properties'], $properties, true, false);

  /*
  * Outcommenting the line above and adding the lines below
  * to override the naming of properties when extending models
  */
  ArrayUtility::mergeRecursiveWithOverrule($properties, $classes[$className]['properties'], true, false);
  $classes[$className]['properties'] = $properties;
}
....

.... this way properties are assigned to the child object's databasefield if the propertyname colides with any parent class.

Also available in: Atom PDF