Bug #4013

Argument handling in RESTController doesn't work correctly

Added by Christoph Blömer over 12 years ago. Updated about 11 years ago.

Status:
Resolved
Priority:
Should have
Category:
MVC
Start date:
2009-07-28
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Complexity:

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.

#1

Updated by Robert Lemke over 12 years ago

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

Updated by Karsten Dambekalns over 12 years ago

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

Updated by Karsten Dambekalns about 12 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
#4

Updated by Karsten Dambekalns about 12 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.

#5

Updated by Karsten Dambekalns about 12 years ago

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

Applied in changeset r3225.

Also available in: Atom PDF