Project

General

Profile

Actions

Task #48964

closed

Enable property path for nested objects (ObjectStorages) in forms

Added by Nico de Haen almost 11 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2013-06-08
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

It is not possible to create a form for editing multiple objects residing in a object property of type ObjectStorage.
Example:
Model: Contact
Property: Adresses (ObjectStorage containing multiple Adress-Models)

<f:form object="{Contact}">
    <for each="{Contact.Adresses}" as="adress">
        <f:form.textfield property="adress.street" />  // not possible 
        <f:form.textfield property="adress[].street" />  // not possible 
    <f:/for>
<f:/form>

Files

ObjectAccess.patch (1.77 KB) ObjectAccess.patch Nico de Haen, 2013-06-08 18:09
ObjectAccess.patch (1.39 KB) ObjectAccess.patch Nico de Haen, 2013-06-08 18:13
Actions #1

Updated by Nico de Haen almost 11 years ago

A possible solution could be to add an index in the property path:

<f:form object="{Contact}" iteration="i">
    <for each="{Contact.Adresses}" as="adress">
        <f:form.textfield property="Adresses.{i.index}.street" />
    <f:/for>
<f:/form>

This would render a correct form, including the __identity for the object at the right level and index, but the ObjectAccessor can't map the property map since it can not handle the "index" part in the property path. I attach a patch (for Extbase) which enables the mapping for properties of type ObjectStorage/SPLObjectStorage.

(See below the patch without "use Debugger" statement)

Actions #3

Updated by Anja Leichsenring almost 11 years ago

  • Status changed from New to Accepted

nice improvement Nico, thank you. We will have a close look in short order.

Actions #4

Updated by Alexander Opitz over 9 years ago

  • Project changed from 2559 to TYPO3 Core
  • Category changed from Fluid to Fluid
  • TYPO3 Version set to 6.2
Actions #5

Updated by Thomas Löffler over 9 years ago

What's the status of this issue?
Would be great to have it minimum in 6.2!

Or is there another way to do such things yet?

Actions #6

Updated by Valentin Funk over 9 years ago

Thomas Löffler wrote:

What's the status of this issue?
Would be great to have it minimum in 6.2!

Or is there another way to do such things yet?

That was my question! ;-)

Actions #7

Updated by Gernot Ploiner about 9 years ago

vote +1

Actions #8

Updated by Claus Due over 8 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100
  • TYPO3 Version changed from 6.2 to 7

A few comments before closing time:

  • No longer applies in current TYPO3 versions (non-LTS) where ObjectAccess supports numeric indexes also for ObjectStorage
  • Not "fixable" in 6.2 where support for numeric indexes would be a breaking change for some people relying on the old object-ID index names
  • Suggested workaround is the intended usage: property="storageObjects.{index}.propertyname" (on non-LTS)
  • Suggested syntax is not valid for "property" attribute (but is valid for "name" attribute; even required when field is multivalued).
  • Only known non-destructive workaround for 6.2 is to use "name" instead of "property"
  • line 165 of the suggested patch would also be a breaking change.

Closing this with "already merged for non-LTS, not mergable on LTS without breaking".

PS: sorry about this taking so long guys but I think it may be due to the general fear of touching ObjectAccess - it just has so widespread use that the slightest break could spell disaster for production sites.

Actions #9

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF