Controller actionMethod with parameters?

Hello

At first, is it even possible for Controller::actionMethod to have a parameter?

If yes, is there any way, i could pass a parameter to controller action, when running it with:


Yii::app()->runController($route);

I am wondering about something like




$route = 'myController/actionMethod/10'



will result in calling myController::actionMethod(10)

any advice appreciated

Smeto

Parameters are normally passed to actions via the $_GET and $_POST arrays.

An action method can have a paramter like this:

funtion actionDelete($param = null) {

}

This way you could pass a parameter if you are calling the action method manually.

I used this once when 2 actions were almost identical.

The second action just called the first one with a paramter set

so it would behave slightly different. This got rid of some redundant code.

Action methods should not accept parameters. Controllers can have other (protected) methods that do repetitive business logic, so you can call them from various actions.

One should rely on application parameters and user input to decide an action’s actual behavior.

thats what i thought:)

thanx