Tatter\Relations - Feature: Loading additional fields in join tables |
Hey all,
I'm currently fooling around with the \Tatter\Relations plugin and I'm missing one function. I have two tables 'matches' and 'players' wich have a manyToMany relationship via the table 'matches_players'. This join table holds an additional field besides the indexes, which is called 'available' and keeps the availability of each player to participate in each respective match. As far as I see, \Tatter\Relations has no option to include such fields in the result yet (please correct me if I'm wrong ). I added a short workaround for that in the BaseTrait which goes as follows: PHP Code: // Get pivot table from schema See: https://github.com/sfadschm/codeigniter4...#L149-L159 This automatically adds all fields in the join table except the pivot fields to the select list for manyToMany relations. While this is not really pretty yet, I wonder if this functionality is useful for others to (and desired). If so, I'd like to implement this fully and maybe bind it to a config setting or even a new modifier function (like $this->withAdditionalFields(true). Would be great to get some opinions on this. Maybe from @MGatner? |
Messages In This Thread |
Tatter\Relations - Feature: Loading additional fields in join tables - by aschmitz - 11-08-2020, 09:22 AM
RE: Tatter\Relations - Feature: Loading additional fields in join tables - by MGatner - 11-08-2020, 09:43 AM
RE: Tatter\Relations - Feature: Loading additional fields in join tables - by aschmitz - 11-08-2020, 09:51 AM
|