Here is my use case:
I have created a media bundle (FILM IMG) to store a media entity (image) field. I can manage it at admin/structure/media/manage/film_img/fields
In a content type named "FILM" , I have added a entity reference field which reference my "FILM IMG" media entity bundle.
I am also using file_field_path module to rename the uploaded images. When I am adding a new image for a new Film, I would like to use hook_filefield_paths_process_file to rename my image file name.
This hook is providing me the media entity ($entity) as a parameter, but of course it is not providing the Film entity that I need (I need it to get some info to rename my file name)
Here is my question: How to get the "parent" entity from the referenced entity;
In other words, with my use case: How to get my film node from the image media entity provided by the hook.