Yii Framework Forum: Guid / Uuid / Routing / Url Manager - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Guid / Uuid / Routing / Url Manager Setup routing to account for UUID's Rate Topic: -----

#1 User is offline   Zeam 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 15-September 12

Posted 27 March 2013 - 11:15 PM

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.yiiframew...url#entry128241
1

#2 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 27 March 2013 - 11:25 PM

/* moved from General Discussion :) */
"Less noise - more signal"
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users