PortID is a foreign key, which links to the LookupID (not the ID, please don’t ask why). ID on Port is the primary key.
Is there any way to automatically generate the BELONGS::TO relation for Port correctly? At the moment, it just ignores that foreign key - and it is because LookupID is not a primary key I believe.
I know I can edit the model manually, I don’t want to though … I am in the process of writing a set of templates that will be run using giic to generate the models and crud. The database I do not have full control over - it is legacy and it is structured as I explained. Because the foreign key is pointing to a field that is not the primary key, gii will not generate the relations code for it. I am using MS SQL SERVER … in itself not an issue, I have used it previously with Yii.