Let $(\mathcal{H},\langle\cdot,\cdot\rangle)$ be a complex Hilbert space. Furthermore, let $E:\mathcal{D}(E)\to\mathcal{H}$ be a self-adjoint unbounded operator and $A:\mathcal{D}(A)\to\mathcal{H}$ (not necessarily self-adjoint) another unbounded densely-defined operator such that $$EA=AE$$ on the common domain $\mathcal{D}(AE)\cap\mathcal{D}(EA)$. Lets now take a bounded continuous function $f\in C(\sigma(E),\mathbb{C})$ and define the bounded operator $f(E)\in\mathcal{B}(\mathcal{H})$ by means of the spectral calculus.
Under which additional assumptions is it true that $f(E)A=Af(E)$ on $\mathcal{D}(A)\cap\mathcal{D}(Af(E))$?
I was looking in the internet and there seems to be some theorems about the commutation of operators and the spectral theorem, but I was not able to find a version in which both operators are unbounded.