[Flow] [SOLVED] RestController - updated Objects are not persisted
Robert Berghegger
r_berghegger at web.de
Wed Oct 16 13:23:29 CEST 2013
Hi Bastian,
thanks for this reasonable and in-depth answer. Your second solution was
what i was looking for :-)
I applied your patch and it works as expected!
Robert
Am 15.10.2013 11:26, schrieb Bastian Waidelich:
> Robert Berghegger wrote:
>
> Hi Robert & Stephen,
>
> first note that it's *not* true that automatic persistence happens
> only for POST requests! It's only disabled for "safe requests"
> (usually "GET", "HEAD" & "OPTIONS"). See [1]
>
>
>> If i change my routing from:
>>
>> name: 'Single CD URI'
>> uriPattern: 'cd/{cd}'
>
> [...]
>
>> name: 'Single CD URI'
>> uriPattern: 'cd/{cd.__identity}'
>
>> The Object with updated attributes is passed to the updateAction. I'm
>> curious to know why this is happening.
>
> You just hit that "bug": http://forge.typo3.org/issues/45290
>
> Unfortunately this couldn't be solved so that it works completely out
> of the box because it's rather a logical than a technical issue:
>
> The resolved route values are merged with your (body) arguments and
>
> array(
> 'cd' => 'b068de1b-e53e-706f-a17e-a7b08176ca92'
> )
>
> overrules your
>
> array(
> 'cd' => array('title' => 'Eternal Movement', 'artist' => 'Tides
> from nebula')
> )
>
> from the request body.
>
> There are two ways to solve this:
>
> 1: add the identifier to the body request:
>
> cd[__identity]=b068de1b-e53e-706f-a17e-a7b08176ca92cd&[title]=Eternal
> Movement&cd[artist]=Tides from nebula
>
> ..but this is not exactly REST-style
>
> 2: Use object routing[1]:
>
> -
> name: 'Single CD URI'
> uriPattern: 'cd/{cd}'
> defaults:
> '@package': 'Berghegger.CD'
> '@controller': 'CD'
> routeParts:
> 'cd':
> objectType: 'Berghegger\CD\Domain\Model\CD'
>
> -
> name: 'CD List URI'
> uriPattern: 'cd'
> defaults:
> '@package': 'Berghegger.CD'
> '@controller': 'CD'
>
>
> NOTE: There currently exists a bug that provokes an exception if you
> don't specify an "uriPattern" for the object-RoutePart. A good chance
> to apply and verify https://review.typo3.org/#/c/24490/ ;)
>
> HTH
>
>
> [1]
> http://docs.typo3.org/flow/TYPO3FlowDocumentation/TheDefinitiveGuide/PartIII/Routing.html#object-route-parts
>
>
More information about the Flow
mailing list