---
title: "Property Mapper bei Sub Sub Objekten"
url: "https://www.typo3.net/d/118011-property-mapper-bei-sub-sub-objekten"
source: "typo3.net"
tags: ["Extensions","Extbase","Frage"]
created: "2014-05-07"
last_reply: "2014-05-21"
replies: 2
solved: false
page: 1
pages: 1
lang: "de"
---

# Property Mapper bei Sub Sub Objekten

Extensions › Extbase · 2 Antworten · gestartet 2014-05-07

## Eröffnungsbeitrag

**shaak** · 2014-05-07 · [Beitrag #1](https://www.typo3.net/d/118011-property-mapper-bei-sub-sub-objekten/1)

Hallo,
ich kämpfe mit dem Property Mapper bei einem verschachtelten Objekt.
Es gibt das Objekt Types das beinhaltet x Objekte des Types Workspace und dieses wiederum beinhaltet x Objekte des Types Instructions.

Das Ganze wird im Fe angelegt und kann über einen Ajaxaufruf mit Formularfeldern zum Anlegen von Workspaces und Instructions gefüllt werden.

Beim Speichern wird dann ein Array übergeben, das so ankommt:

```php
Array
(
    [action] => updateEverything
    [controller] => Types
    [types] => Array
        (
            [__identity] => 11
            [workspace] => Array
                (
                    [0] => Array
                        (
                            [uid] => 1
                            [name] => WS1
                            [location] => b1
                            [instructions] => Array
                                (
                                    [0] => Array
                                        (
                                            [name] => Anleitung 1
                                            [small] => kurz
                                            [middel] => mittel
                                            [large] => lang
                                            [teaser] => beschreibung
                                        )

                                )

                        )

                    [1] => Array
                        (
                            [uid] => 2
                            [name] => WS2
                            [location] => B2 
                        )

                )

        )
)
```

Es gibt also das Objekt Types mit der UID 11, darin die Workspaces WS1 (UID 1) und WS2 (UID 2). In WS1 liegt die Instruction Anleitung 1, die noch nicht persistiert ist.

Das ganze soll nun gespeichert werden.
Dazu habe ich diese initializeUpdateEverything Action geschrieben:

```php
     public function initializeUpdateEverythingAction(){
	$propertyMappingConfiguration = $this->arguments->getArgument('types')->getPropertyMappingConfiguration();
	$propertyMappingConfiguration->allowProperties('workspace');
	$propertyMappingConfiguration->forProperty('workspace')->allowAllProperties();
	$propertyMappingConfiguration->allowModificationForSubProperty('workspace');
	
	$types = $this->request->getArgument('types');
	foreach($types['workspace'][0] as $workspaceIndex => $workspacePropertyArray){   
	    $propertyPath = 'workspace.*.'.$workspaceIndex;
	    $propertyMappingConfiguration->forProperty($propertyPath)->allowAllProperties();
	    $propertyMappingConfiguration->allowCreationForSubProperty($propertyPath);
	    $propertyMappingConfiguration->allowModificationForSubProperty($propertyPath);
	    
	}
    }
```

Ich schaffe es damit aber nicht, das Sub Sub Objekt Instructions zu anzusprechen. Ich kriege immer die Fehlermeldung:
#1297759968: Exception while property mapping at property path "workspace.0":It is not allowed to map property "instructions". You need to use $propertyMappingConfiguration->allowProperties('instructions') to enable mapping of this property.

Wo genau liegt noch der Fehler, oder kann man Sub Sub Objekte nicht mit persistieren?

Vielen Dank Sebastian

## Antworten

### [#2](https://www.typo3.net/d/118011-property-mapper-bei-sub-sub-objekten/2) · aemka · 2014-05-21

Korrektes Validieren und Verarbeiten von Child Nodes gibt es erst an 6.2. Auf welcher Version arbeitest du?

### [#3](https://www.typo3.net/d/118011-property-mapper-bei-sub-sub-objekten/3) · shaak · 2014-05-21

Mit einer 6.2 Installation

---

Quelle: „Property Mapper bei Sub Sub Objekten“, typo3.net, https://www.typo3.net/d/118011-property-mapper-bei-sub-sub-objekten
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
