title: Symfony form validate entity
body: <p>I have two entoty User and Location and I crate model with two entity and create form for this model and add validate_group for this form? but ahen I check form is valid - form always valid, but entity is emthy and entity have assert not blank fields, what I'am doing wrong ? </p>
  
  <p>entities </p>
  
  <pre><code>class User implements UserInterface, \JsonSerializable
  {
  use GedmoTrait;
  
  /**
   * @var integer
   *
   * @ORM\Column(type="integer")
   * @ORM\Id
   * @ORM\GeneratedValue(strategy="AUTO")
   */
  private $id;
  
  /**
   * @var string
   *
   * @Assert\NotBlank(groups={"admin_user_post"})
   * @ORM\Column(type="string", length=255, nullable=true)
   */
  private $firstName;
  
  
  class Location
  {
  /**
   * @var integer
   *
   * @ORM\Column(type="integer")
   * @ORM\Id
   * @ORM\GeneratedValue(strategy="AUTO")
   */
  private $id;
  
  /**
   * @var string
   *
   * @Assert\NotBlank(groups={"admin_user_post"})
   * @ORM\Column(type="string", length=255, nullable=true)
   */
  private $address;
  </code></pre>
  
  <p>create form</p>
  
  <pre><code>class CreateUser extends AbstractType
  {
  /**
   * @param FormBuilderInterface $builder
   * @param array                $options
   */
  public function buildForm(FormBuilderInterface $builder, array $options)
  {
      $builder-&gt;add('user', new UserType(), ['validation_groups' =&gt; ['admin_user_post']]);
      $builder-&gt;add('location', new LocationType(), ['validation_groups' =&gt; ['admin_user_post']]);
  }
  
  /**
   * @param OptionsResolverInterface $resolver
   */
  public function setDefaultOptions(OptionsResolverInterface $resolver)
  {
      $resolver-&gt;setDefaults(array(
          'data_class' =&gt; 'AdminBundle\Model\CreateUserModel',
          'csrf_protection' =&gt; false,
          'validation_groups' =&gt; ['admin_user_post']            
      ));
  }
  
      /**
   * @param FormBuilderInterface $builder
   * @param array $options
   */
  public function buildForm(FormBuilderInterface $builder, array $options)
  {
      $builder
          -&gt;add('firstName')
  }
  
  /**
   * @param OptionsResolverInterface $resolver
   */
  public function setDefaultOptions(OptionsResolverInterface $resolver)
  {
      $resolver-&gt;setDefaults(array(
          'data_class' =&gt; 'AppBundle\Entity\User',
          'csrf_protection' =&gt; false,
          'validation_groups' =&gt; ['admin_user_post']
      ));
  }
  
      /**
   * @param FormBuilderInterface $builder
   * @param array $options
   */
  public function buildForm(FormBuilderInterface $builder, array $options)
  {
      $builder
          -&gt;add('address')
          -&gt;add('cityObject', null, array('attr' =&gt; array('placeholder' =&gt; 'Select city')));
  }
  
  /**
   * @param OptionsResolverInterface $resolver
   */
  public function setDefaultOptions(OptionsResolverInterface $resolver)
  {
      $resolver-&gt;setDefaults(array(
          'data_class' =&gt; 'AppBundle\Entity\Location',
          'csrf_protection' =&gt; false,
          'validation_groups' =&gt; ['admin_user_post']
      ));
  }
  </code></pre>
  
  <p>and action </p>
  
  <pre><code>        $entity = new CreateUserModel();
  
      $form = $this-&gt;createCreateForm($entity);
      $form-&gt;handleRequest($request);
  
      if ($form-&gt;isValid()
          &amp;&amp; $form-&gt;get('user')-&gt;isValid()
          &amp;&amp; $form-&gt;get('location')-&gt;isValid()
      ) {
          $em = $this-&gt;getDoctrine()-&gt;getManager();
          $em-&gt;persist($entity-&gt;getLocation());
          $entity-&gt;getUser()-&gt;setLocation($entity-&gt;getLocation());
          $em-&gt;persist($entity-&gt;getUser());
          $em-&gt;flush();
          $user = $entity-&gt;getUser();
  
          return $this-&gt;redirect($this-&gt;generateUrl('admin_users_show', array('id' =&gt; $user-&gt;getId())));
      }
  
      /**
   * Creates a form to create a User entity.
   *
   * @param CreateUserModel $entity The entity
   *
   * @return \Symfony\Component\Form\Form The form
   */
  private function createCreateForm(CreateUserModel $entity)
  {
      $form = $this-&gt;createForm(new CreateUser(), $entity, array(
          'validation_groups' =&gt; ['admin_user_post'],
          'action' =&gt; $this-&gt;generateUrl('admin_users_create'),
          'method' =&gt; 'POST',
      ));
  
      $form-&gt;add('submit', 'submit', array('label' =&gt; 'Create'));
  
      return $form;
  }
  </code></pre>
  
  <p>I try in action</p>
  
  <pre><code>$error = $this-&gt;get('validator')-&gt;validate($form-&gt;getData()-&gt;getUser(), ['admin_create_user']);
  </code></pre>
  
  <p>but still have empty <code>$error</code></p>
  
  <p>Why form is valid true ? or how correct valid form model with my entities and assert in this entities ? </p>