[Flow] How does RestController update work under the hood?
Max Mustermann
gj at webandco.com
Thu Aug 21 13:25:02 CEST 2014
Hi all,
i have a RestController which only has the minimum needed methods
createAction, listAction, showAction, updateAction, deleteAction.
My problem is the updateAction.
If i call the controller like
PUT myflow.local/api/article/SOMEARTICLEID
including http body like
name=newarticlename&price=10.00
the updateAction gets called, but the argument of the udpateAction contains the (old) data from the database.
so if i call articleRepository->update($article); it doesnt change anything, cause $article contains old data.
i also tried http body like
article[name]=newarticlename&article[price]=10.00
which doesnt work either
my questions are:
at which line in the typo3.flow package should the PUT http body be merged into the entity?
how should the http PUT request should really look like? i found a few examples, but everyone seems to do it different.
some use {article.__identity} in the route others dont. some use article[] in the body, others dont.
as a note: every action of my article restcontroller works, except update which gets called with the correct entity i wanna update,
but without the new data which shall change - so i dont assume a routing problem or such.
my route looks like this:
-
name: 'Api - article'
uriPattern: 'api/article'
defaults:
'@package': 'Project.Api'
'@controller': 'Article'
'@action': 'index'
'@format': 'json'
-
name: 'Api - Article POST'
uriPattern: 'api/article/{article}'
defaults:
'@package': 'Project.Api'
'@controller': 'Article'
'@action': 'index'
'@format': 'json'
thanks for any help
More information about the Flow
mailing list