Issue with Controllers, default actions, and named parameters

I keep running into a problem when organizing my controllers.

Often I have a controller file with several actions, some which take named parameters, which yii handles very well.

So I might have something like

class CarController extends Controller

{

public function actionDrive($road=‘highway51’)

{

}

public function actionPark($address=‘myhouse’)

{

}

}

Ok so that works fine and i can use urls like http://mysite.com/car/drive/highway71 , which is excellent.

HOWEVER

Sometimes there is a lot of code and there would be a benefit to putting each action as a separate controller.

Now yii actually handles this in an awesome way by allowing me to create for example a file Car/DriveController.php

with

class DriveController extends Controller

{

public $defaultAction = ‘work’;

public function actionWork($road=‘highway51’)

{

}

}

Now this will let me make the same call if i dont pass an arguement: http://mysite.com/car/drive

but it will fail if i try to pass it the named argument, e.g.: http://mysite.com/car/drive/highway44

I would love to be able to sometimes use this organization and use named arguments.

Perhaps another way to phrase this is that sometimes id like the subdirectory name to be sufficient for locating the controller, without having to specify an additional name that must be on the url path.

Is there a way to do this that I’m missing?

Perhaps a much simpler way to explain what i want to do is simply that the defaultAction system works perfectly EXCEPT that it breaks when it comes to named parameters.

Yii can figure out that it should use the default action when a controller file is activated via a path to that file, but it gets confused when named parameters are passed.

I’m hoping there is a way to fix it so that it works even in this case, or that I could request such a feature.

Note: Here’s someone on the forum with the same problem: http://www.yiiframework.com/forum/index.php/topic/20806-how-to-append-parameter-in-url-for-default-action/page__p__101929__hl__default+action+parameter+#entry101929

I have a “fix” to the yii source code for this – it’s a bit ugly/kludgey so i doubt that yii developer(s) would want to incorporate it, but it won’t break any existing code… what would be the best way to submit a patch for potential inclusion?