[BUGFIX] Make object access work with ObjectStorage 23/29923/6
authorHelmut Hummel <helmut.hummel@typo3.org>
Wed, 7 May 2014 17:30:57 +0000 (19:30 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Mon, 2 Jun 2014 10:41:19 +0000 (12:41 +0200)
commit9af2142bce1b27ccf786fd224c15e29b8bc0bd82
treec4ecbd1b5efb41c892baf817976cbe846deae25d
parent1d23e5e04424060237f9e5b26421efca6efd93b2
[BUGFIX] Make object access work with ObjectStorage

ObjectAccess->getPropertyPath() does not work with
ObjectStorage and numerical indexes, but it should be
because without it form fluid fields cannot be
properly handled as the value is always null.

Fixing fetching objects from ObjectStorage by index
will also enable shorter access of single objects in Fluid.

Imagine you want to render the first image in your
template. Previously you had to write this:

<f:for each="{object.images}" as="image" iteration="iterator">
<f:if condition="{iterator.isFirst}">
<f:image image="{image}" alt="" width="50"/>
</f:if>
</f:for>

Now you can just write:

<f:image image="{object.images.0}" alt="" width="50"/>

Resolves: #37126
Related: #37000
Releases: 6.2
Change-Id: I45122bd145b5a179ad3e9e3894520f9a614906c8
Reviewed-on: https://review.typo3.org/29923
Reviewed-by: Markus Klein
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Fabien Udriot
Reviewed-by: Tymoteusz Motylewski
Tested-by: Tymoteusz Motylewski
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
typo3/sysext/extbase/Classes/Reflection/ObjectAccess.php
typo3/sysext/extbase/Tests/Unit/Reflection/ObjectAccessTest.php