Cactiverecord... Some Relations Have "0" Suffixed?

Hi folks,

I’m currently in the process of modelling my DB tables and several times when I have gone to enter the “with()” relation between 2 tables, I have noticed that the relation name has a zero suffix onto it. For instance, “product” is showing as “product0” etc.

Can I ask if this is normal and, if so, why this occurs?

I think you may have a column with product name in your db table

Hi mate,

Yeah, most or all of the relations have the a column of the same name so table "product" contains a column called "product". Ia this bad practice? Would it be better to have table "product" with the column name renamed to "product_name"?

no it’s not bad practice but relations name and columns name both behave as model’s attributes so they can’t have same names for this reason when gii generates relations it add a 0 after your relation name you can change it but remmember to consider this matter

Merc baradaram. Nokaram.