Strangely enough I was wanting to do this and searching StackOverflow just as you posted.
In sfGuardUserForm.class.php
For 'normal' fields (e.g. first_name, last_name), use getValidator:
public function configure()
{
parent::configure();
...
// You may not need to set the field as true, depending on your sfDoctrineGuard schema
$this->getValidator('first_name')->setOption('required', true);
$this->getValidator('first_name')->setMessage('required', 'Please enter your first name');
}
For fields in the PostValidator, the messages can be changed in the code:
public function configure()
{
parent::configure();
...
// Handle the email address error - more complicated than the rest
$pv = $this->validatorSchema->getPostValidator()->getValidators();
$pv[0]->setMessage('invalid', "Someone has already registered with this email address");
}
Source for the basic idea
In sfGuardFormSignin.class.php
There doesn't seem to be an easy to follow logic here... for this post validator I used the following:
public function configure()
{
parent::configure();
$this->validatorSchema->getPostValidator()->setMessage('invalid', 'Your email address or password is invalid');
}
I ended up with this structure through trial and error, but it works. (Now I need to move the post validator error from the 'username' field to a global error)
Other useful resources
This post shows how to set default messages to replace the rather unhelpful default symfony form errors.