The general solution of y '' + w^2.y = 0 is
y(x) = A.sin(wx) + B.cos(wx) or y(x) = A.cos(wx + phi0)
Either way, there are two parameters. You are applying one of the boundary conditions. You actually are going to apply another boundary condition to y'(x) in order to completely nail down the solution.

Alternatively, the two conditions you are using phi(-a) = 0, phi(a) = 0.
From this, you get two families of solutions. One with sin, the other with cos. This equivalent to using the second general solution with the phi0 alternating between 0 and pi/2

\[A \sin( \omega a)+B \cos( \omega a)\]
It is harder to make this expression = 0 in this form than yours, as both summands cannot be made = 0 or the negative of the other by eyeballing it, so yours is simpler.
Thanks, I think I've got it.

@JamesJ , sorry to tag you, but I have a (very) brief question: the general solution is \[ \varphi= A e^{\pm i \omega x}\]
What is done with \[\Im(\varphi)\]? Is only the real part considered, as is often done in classical mechanics?
Thanks again