Story #11938: As an extension developer I want to be able to use bidirectional relations
Getter methods for foreign key fields
|Priority:||Should have||Due date:|
At the moment, for foreign key fields only a passthrough field is created in the TCA of the referenced object.
Occasionally however, it would be nice if such a relation could be traversed in both directions (if you have for example two domain objects "Group" and "User", then you might want to have a method Group::getUsers() but also a method User::getGroup()).
I have attached a rudimentary patch that replaces the default passthrough field that is generated for the referenced table with a select-Field and adds an appropriate getter method in the domain model object.
An alternative solution would be to have the user create two separate unidirectional relations, i.e. in the example above one 0..* relation from "Group" -> "User" and a 0..1 relation from "User" -> "Group". In this case however, the kickstarter creates two fields both named "group", one as a passthrough, and the other as an inline field...
Updated by Martin Helmich over 2 years ago
- File getterForForeignKeys-2.diff added
Ouch. Apparently, I was not in my best state of mind when writing this issue; in my patch, I mixed up the different table names of the relations; an updated patch is attached... ;)