Findbypk(1Xyz) And Find('id=:id',array(':id'=>1Xyz)

Just noticed that both AR methods below returns the row with PK Value = 1

  $_GET['id'] has value of 1XYZ

  Table::model()->findByPK($_GET['id']) and 


PK name may be different from ‘id’, so it’s just for ease of use.

Is your question about [font="Courier New"]1XYZ[/font] having been transformed into [font="Courier New"]1[/font]?

You are right Orey

My point is that the ‘id’ attribute is defined as integer.

I am not expecting a result for id=1 when id value in $_GET=‘1XYZ’

May be it is a feature as auto-increment attribute is suppose to be integer.

Yes, and I think, the Active Record does type cast to (int). Will check.

Oh, my bad. Didn’t see the value of 1XYZ, sorry.

Are you sure of $_GET[‘id’]?

Maybe the rules have cutted the xyz out, and you already receive 1 in get

I quickly scanned thru few base code’s functions and could not see any issues.

On any of your existing model try it! But it is not an issue with Yii

I did a quick

  select * from category where id='2w'; on Toad for MySQL and it does fetch the row with id =2