I have the problem that I need to add two IDs for elements which I need to store with EAV Containers: building_id and level_id. With the normal EAV logic I can store the building_id.
The idea now is, that I set the level_id with an Observer before saving the entries, but that doesn't work in the way I do it now.
I have no idea in which of the Models I need to run that Obsever, so I added it actually to both. As I also have no experience with writing Observers, I just try to do something, of what might run, but it doesn't do the expected.
Hope someone can help me letting me know, how I can add this ID correctly via Observer or any other better way.
Assuming the observer can have some external means of fetching the current level_id, it should be an observer on the EAV model (not on either building or level), that runs on create.
Thanks Harro, I now have this Observer running only in the Model Levelplan, which holds the EAV data.
Also changed before_save to before_insert.
But how can I now pass the $level_id from my controller to the Observer. I didn't find any similar example in the Observers which are in the system, so have no clue how to do that?