In Kanamori's Bernays and Set Theory pages 20-21, a first order reflection principle due to Bernays is mentioned, that of:
$$\sf \varphi \to \exists y \, (\text {Trans}(y) \land \varphi^y)$$ for formulas $\varphi$ without $\sf y$ or any class variables, where $\sf Trans(y) $ asserts that $\sf y$ is transitive; $\sf \varphi ^ y$ denotes the relativization of the formula $\varphi$ to the set $\sf y$, i.e., $\exists x$ is replaced by $\exists x \in \sf y$ and $\forall x$ by $\forall x \in \sf y$. Starting with the observation that set parameters $a_1,...,a_n$ can appear in $\varphi$ and $\sf y$ can be required to contain them by introducing clauses $\exists x(a_i \in x)$ into $\varphi$. Bernays just with his schema established Pair, Union, Infinity, and Replacement (schema)—in effect achieving a remarkably economical presentation of ZF.
My question: what is the proof of replacement from reflection? It's easy to see that Reflection can prove Pairing, Union, and Infinity. But the proof of Replacement is what's escaping me.
I tried to reflect the formula: $\exists x (a \in x) \land \forall m \in a \exists ! z: \phi(m,z)$ on the transitive set $\sf y$, but what we'll get is a set (which is $\sf y$) that contains the $z$'s of $\phi^\sf y$ among its elements, and I don't know how those are the same $z$'s of $\phi$?