How Gii Recognizes Has_One Relations

Hi, I just recently found a case where I need to use a HAS_ONE relation but defining a foreign key in a table generates a HAS_MANY relation in the model when using Gii. How can I get a HAS_ONE relation?

Thanks in advance.

just change generated self::HAS_MANY to self::HAS_ONE

there is no difference in database representations of both cases so the generator cannot determine which to choose, but HAS_MANY covers all possibilities (when there is only one dependent record you will just get one record in array). Also - this is main benefit of scaffolding scenario: you generate base code but then you can adapt it and change the way you want

Ok. This is my current approach. Doubts cleared. Thanks again