In SymfonyForm\ChangePasswordTypeyou can use something like this:
$builder->add('password', 'repeated', array(
'type' => 'password',
'first_name' => 'Password',
'second_name' => 'Password confirmation',
'invalid_message' => 'Passwords are not the same',
));
With Symfony 2.1, you can tweak the parameters to avoid a broken element name (as indicated in the comment)
$builder->add('password', 'repeated', array(
'first_name' => 'passwd',
'second_name' => 'passwd_confirm',
'first_options' => array('label' => 'Password'),
'second_options' => array('label' => 'Password confirmation'),
));
source
share