I have a situation where I need to validate a form without actually having an object to store anywhere. In this scenario, would I still create an Entity without doctrine and
See the Using a Form without a Class section — there is a subsection on validation, too.
The answer is to setup the constraints yourself, and attach them to the individual fields.
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
$builder
->add('firstName', 'text', array(
'constraints' => new Length(array('min' => 3)),
))
->add('lastName', 'text', array(
'constraints' => array(
new NotBlank(),
new Length(array('min' => 3)),
),
))
;