Relations name same as Table name same as field name

Hi everyone,

Not sure this is a bug but I noticed that when i declare a relation that has the same name with the related table and one field of the related table, it just doesn’t work…

For example in my ‘Comments’ model, I had the Relation:


'category' => array(self::BELONGS_TO, 'Category', 'idCategory'),

My SQL table ‘category’ has a field name ‘category’ so in my view I was trying to print it using ‘$row->category->category’ and it wasn’t working.

To solve the problem I just had to change the name of the Relations. Is it normal?

Info :

Browser : Firefox

Server : Apache

Yii version : 1.1.10

Windows 7

Can you please be a bit more concrete about “it wasn’t working.”?

What did you do, what did you expect and what did you see instead?