Bug #75231

PropertyMapper fails for Demand-Object like objects

Added by Bernhard Kraft over 3 years ago. Updated 5 months ago.

Should have
Start date:
Due date:
% Done:


TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:


When creating a Dto which is used for Demand-Object like tasks the property mapper will fail to map sub-properties within an "ObjectStorage". Think of a demandObject which gets passed to a controller as argument.

The demandObject itself should not get persisted, but the properties it relates to can be UIDs of some already persisted domain objects. The DemandObject (DTO) could look like:

namespace Myspace\MyExt\Domain\Dto;

 * A demand object 
class DemandProduct {

     * The country in which the product must be located
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Myspace\MyExt\Domain\Model\Country>
    protected $country = NULL;

    /* ... getters and setters ... */


Now when you have a controller which gets passed such an object the property mapper will fail for a request like:


The facts:

1. The PropertyMapper will choose the "ObjectConverter" type converter for generating the "DemandProduct" class as the "DemandProduct" class does not inherit from an persistable domain model class "\TYPO3\CMS\Extbase\DomainObject\AbstractEntity"

2. The PropertyMapper would correctly choose "ObjectStorageConverter" for converting the list of passed "country" arguments when "country.*" gets set as allowed (or the value is posted from within a f:fluid form and has correct trusted properties parameter)

3. The PropertyMapper would correctly choose "PeristentObjectConverter" for the "Country" Domain model objects as the inherit from "AbstractEntity".

The reason for failing:

The reason this will fail is that the "ObjectConverter" of the base-object (DemandProduct) does not pass the "full" property types "ObjectStorage<DomainModel>" to the ObjectStorageConverter but only the base class "ObjectStorage".

To get a clue on this compare the "getTypeOfChildProperty" method from both: The "ObjectConverter" and the "PeristentObjectConverter":


While the "ObjectConverter" variant of "getTypeOfChildProperty()" inspects the method nacelle the "PersistentObjectConverter" variant of the method inspects the DTO property.

The property definition annotation contains the full sub-property type: "\TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Myspace\MyExt\Domain\Model\Country>
" while the setter method will most surely only contain the "direct" type of the passed variable: "\TYPO3\CMS\Extbase\Persistence\ObjectStorage" (as the <> notation is not valid for PHP itself)

To solve this issue there should be a configuration option for "ObjectConverter" whether the setter-method-definition of the property-definition for a mapped property should get inspected.

Another solution would be to provide a "PropertyBasedObjectConverter" which behaves like the ObjectConverter in every case except for the mentioned "getTypeOfChildProperty()" method which is taken from the "PersistentObjectConverter".

Related issues

Related to TYPO3 Core - Bug #61628: PropertyMappingConfiguration for ObjectStorages / Arrays New 2014-09-16


#1 Updated by Benni Mack 5 months ago

  • Target version changed from next-patchlevel to Candidate for patchlevel

Also available in: Atom PDF