Error trying to extend SonataMediaBundle "Impossible to invoke a method ("id") on a null variable"
My suggestions are:
When you are creating your builder, use 'empty_on_new' => false.
empty_on_new (default is true): the related data transformer will return null instead of an empty Media instance if no binary content is provided
https://sonata-project.org/bundles/media/3-x/doc/reference/form.html
And you have a ManyToMany relation with PostTags.
Why doesn't you use 'sonata_type_collection' in your ImageAdmin instead of 'sonata_type_model' ?
I hope it will help you.
Good luck !