title: Symfony2 return value of flush metode
body: <p>Ok i got stuck and no info in documentation about this (correct me if i am wrong)</p>
  
  <p>Example: i have update metod in controller, some form and if forim is valid i use flush method to make changes. How can i check if changes were made in DB so i can send flash message if changes were made "Success" or if query is not executed if there is some error i send flash message "Failed to make changes to DB"</p>
  
  <p>Here is example of my code but i think that flush returns  void or null so this is not the way to go, maybe it returns some exceptions on failure i dont know..</p>
  
  <pre><code>/**
   * @Route("createpost", name="createpost")
   */
  public function createPostAction(Request $request) {
      if (!$this-&gt;get('security.authorization_checker')-&gt;isGranted('ROLE_ADMIN')) {
          throw $this-&gt;createAccessDeniedException();
      }
      $post = new Post();
  
      $form = $this-&gt;createForm(new PostForm(), $post);
  
      $form-&gt;handleRequest($request);
  
      if($form-&gt;isValid()) {
          $user = $this-&gt;getUser();
          $author = $user-&gt;getUsername();
  
          //$post-&gt;setPublishDate(new \DateTime);
          $post-&gt;setAuthor($author);
  
          $em = $this-&gt;getDoctrine()-&gt;getManager();
          $em-&gt;persist($post);
          $pom = $em-&gt;flush();
          return $this-&gt;render('success/success.html.twig', array(
             'test' =&gt; var_dump($pom)
          ));
          if($pom) {
              $this-&gt;addFlash(
                  'notice',
                  'You have successfully created post'
              );
  
          }
          return $this-&gt;redirectToRoute('home', array(), 301);
      }
      return $this-&gt;render(
          'create/post.html.twig', array(
             'form' =&gt; $form-&gt;createView()
          ));
  }
  </code></pre>