The very last issue I had to overcome is, when saving the data, I needed to be able to write the table name that is owning the tag into tabl_name field in the EntityTags bridge table.
No matter how hard I tried, I couldn’t create form fields with the info, rewrite the data in the controller, nor beforeMarshall the data. Nothing worked. And there’s that whole really kill-joy but totally offhand comment in the book:
// Multiple select element for belongsToMany
// Does not support _joinData
Finally, while searching for some way to just pass a hint from the controller to the model, I discovered you can pass an array of options to the save method and then access that in beforeSave in any of the models.
So:
->save($recipes, ['tabl_name'=>'recipes'])
And in EntityTags’ beforeSave($event, $EntityTags, $options)
I simply assign $EntityTags->tabl_name = $options['tabl_name']
and it’s all working now.
For anyone that might want to achieve the same kind of thing, I think most of everything they need to know is now shared in this thread.