Bug #4013

Argument handling in RESTController doesn't work correctly

Added by Christoph Blömer almost 4 years ago. Updated over 2 years ago.

Status:Resolved Start date:2009-07-28
Priority:Should have Due date:
Assignee:Karsten Dambekalns % Done:

100%

Category:MVC
Target version:TYPO3 Flow Base Distribution - 1.0 alpha 5
PHP Version: Complexity:
Has patch: FLOW3 version affected:
Votes: 0

Description

The RESTController is inherited from the ActionController. Therefore the ArgumentHandling should work as intended.

The problem is due to the following code of the RESTController class.

public function processRequest(\F3\FLOW3\MVC\RequestInterface $request, \F3\FLOW3\MVC\ResponseInterface $response) {
    $this->arguments->addNewArgument('id', 'UUID', FALSE);
    parent::processRequest($request, $response);
}

Adding an argument in this code portion results in an shift of all arguments of a called method. The value for the 1st argument is now shifted to the second argument.

If addNewArgument is removed from that code it works as intended.

A possible solution would be to move that line into the initializeAction method. The argument is then added to the end of the argument array and not to the beginning.

But actually it also shouldn't be passed to the method if it is not required or specified by the method.

Associated revisions

Revision e4fe5388
Added by Karsten Dambekalns over 3 years ago

[!!!][+BUGFIX] FLOW3 (MVC): The RESTController no longer defines the $id argument for methods, this fixes #4013. You must declare the $id argument properly in your controller actions from now on!

History

Updated by Robert Lemke almost 4 years ago

  • Priority changed from Must have to -- undefined --
  • Target version deleted (1.0 alpha 3)

Updated by Karsten Dambekalns almost 4 years ago

  • Subject changed from Arguement Handling in RESTController doesn't work correctly to Argument handling in RESTController doesn't work correctly

Updated by Karsten Dambekalns over 3 years ago

  • Status changed from New to Accepted
  • Assignee set to Karsten Dambekalns
  • Priority changed from -- undefined -- to Should have
  • Target version set to 1.0 alpha 5

Updated by Karsten Dambekalns over 3 years ago

I propose to drop that we simply drop processRequest() from the RESTController. The $id argument should be specified in the action method's signature as usual, the RESTController would do it's only magic in resolveActionMethodName() then. This solves the problem with argument shifting (I stumbled across this, too) and gives back control over the use of the argument to the developer.

Updated by Karsten Dambekalns over 3 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100

Applied in changeset r3225.

Also available in: Atom PDF