How to validate data for a Rest Service with symfony
- by Nicolas V.
For example imagine I've a rest service, this service takes two parameters :
phone number
text
The goal is to send the message via a sms gateway.
I've a class Message which has two properties destinationNumber and textMessage.
Before calling the gateway, I want to validate the data received by the rest service.
I've two questions relatives to how to validate the data :
Where should I put the validation rules ? in the model or in the controller
How should I use the sfValidator* classes from Symfony to validate the data (ie. where's the documentation for using sfValidator or where can I find some examples)
Any help would be appreciated.