×
This forum has been locked. Please submit new Feature Requests on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues
Handling of foreign key fields
Jonas Fagnastøl Henriksen
Yeni Üye
Posts: 15
10 yıl 3 ay önce #254
Yazan: Jonas Fagnastøl Henriksen
Handling of foreign key fields, Jonas Fagnastøl Henriksen tarafından oluşturuldu
Hi,
I have been using the component creator extensively for a long time, and I'm generally very pleased with it, but:
Recently the handling of foreign key fields was changed, so that when the field is loaded in the model, and returning $this->item->fkey_field in the view actually gives the text-title from the foreign key table, instead of the foreign key id. While I understand this can be useful in some cases, it is very bad anytime you need to get more than just the title-field from the foreign key table.
In my opinion the best solution would be to return the whole foreign-key object (all fields in the foreign key table) as the fkey_field. This way the developer has access to everything in the foreign key object, and has the possibility to chose which fields he want to use in the template overrides. When displaying like a dropdown-list, or on the list view in the component, the display-field can still be used as an alias.
Any other views on this her at the forum?
Jonas
I have been using the component creator extensively for a long time, and I'm generally very pleased with it, but:
Recently the handling of foreign key fields was changed, so that when the field is loaded in the model, and returning $this->item->fkey_field in the view actually gives the text-title from the foreign key table, instead of the foreign key id. While I understand this can be useful in some cases, it is very bad anytime you need to get more than just the title-field from the foreign key table.
In my opinion the best solution would be to return the whole foreign-key object (all fields in the foreign key table) as the fkey_field. This way the developer has access to everything in the foreign key object, and has the possibility to chose which fields he want to use in the template overrides. When displaying like a dropdown-list, or on the list view in the component, the display-field can still be used as an alias.
Any other views on this her at the forum?
Jonas
Şu kullanıcı(lar) Teşekkür etti: Pete, Andres Maeso
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
Francisco
Yeni Üye
Posts: 2
10 yıl 2 ay önce #297
Yazan: Francisco
Francisco tarafından Handling of foreign key fields konusunda yanıtlandı
Im having the same issue. I have to comment the code that loads the Value of the key field instead of the ID, which is much better for me at least.
As i do extra stuff with that ID afterwards. Maybe an opt-in to select what we want to get?
As i do extra stuff with that ID afterwards. Maybe an opt-in to select what we want to get?
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
Jonas Fagnastøl Henriksen
Yeni Üye
Posts: 15
10 yıl 2 ay önce #300
Yazan: Jonas Fagnastøl Henriksen
Jonas Fagnastøl Henriksen tarafından Handling of foreign key fields konusunda yanıtlandı
Thanks, Andrés, this is probably my biggest issue with the component-creator now, which I otherwise think is great! Bug-reports are handled very quickly and nicely, I've been reporting quite a few lately, and VIctor seems to be fixing them more or less as soon as they arrive. This issue is a little different, though, so I thought I'd post it here first.
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
Walt Sorensen
Bronz Üye
Posts: 54
9 yıl 6 ay önce #764
Yazan: Walt Sorensen
Walt Sorensen tarafından Handling of foreign key fields konusunda yanıtlandı
I too would like to see an option for the whole foreign key object to be available so we can have access to all the fields. But I think this should be an option when foreign key is selected, if a developer doesn't want or doesn't need the whole object, there is no reason to load it.
Lütfen sohbete katılmak için Giriş ya da Hesap açın.
Sayfa oluşturma süresi: 0.061 saniye