Submitting form throws error: Call to a member function addMessage()