alphanumeric id

Hello Yii community!

this is my 2nd Yii programming day. ::) I found out that alphanumeric id’s like GUIDs are not supported!? Id’s must be an integer. The admin action is showed, but the view?id=4c5545f2c6c674.70177605 page not. Error 404.

Can I configure alphanumeric Id’s - or am I forced to use auto_increment integers?



I think that the problem cam be this point, or maybe simply this id doesn/t exists

Have you double checked your URL?

the URL is okay

the data exists

id’s without letters work

and I found something like "(int)$id" in generated code

So you found your problem… just remove that…

Modifying the Yii framework ? ? ?

The Yii framwork is what lies in the directoty framework.

The autogenerated code is just a sample, feel free to modify anithing you find here. The basic generated code is thought for work with numeric ids, if you are implementing something different, modify your pages accordigly

Make sure that within your rules you have the id not set to ‘integer’

I have the same issue and no rules() setted at all, neither autogenerated code with (int) binding. So, or it is something I did not, or it’s some imposition of Yii framework I need to overrule. I just didn’t find any doc on this.

I opened a bug report on this one.

hi Junior

I do not use Yii anymore. It is too much effort to change my existing (not finished) application to Yii. Yii is "corsetting" me. BUT I was inspired by Yii. I would use Yii for a new (non business web) app.



So, how does your rules look like?

If it looks like this standard generated rules:

            	'<controller:\w+>/<id:\d+>' => '<controller>/view',

            	'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',

Then you’d be out of luck.

the id part shouldn’t be ‘d+’ then, but ‘w+’.

Try that.

Just a small change.

The url rules are sort of type safe. :)

If a do this, gii stops work.

But this did the trick:







I’m not proud of it.

But, if you use Gii first, then change the overall id rule to w instead of d - wouldn’t that work?

I suspect Gii is hardcoded to handle ids of type number.