Guid / Uuid / Routing / Url Manager

This is just as an FYI, it took me a while to figure this out so I thought I would create a forum post to help someone else in the future.

I use UUID’s for my primary key. Not an issue until you create a URL like:

www.domain.com/mycontroller/myaction/2b3c211b-e0de-4287-b6ff-088f4db8c982

You expect Yii to assign the UUID to $id… Well you can with these routing rules:

'<controller:\w+>/<id:[\w-]+>' => '<controller>/view',


'<controller:\w+>/<action:\w+>/<id:[\w-]+>' => '<controller>/<action>',

Hopefully this helps someone!

credit goes here: http://www.yiiframework.com/forum/index.php/topic/18412-new-yii-rest-tutorial/page__p__128241__hl__uuid+url#entry128241

[color="#006400"]/* moved from General Discussion :) */[/color]