Updating data on a blog I want to make post editing on my blog. I get data from a form and want to put it into a database. I'm not sure if using setters is the best way, so maybe you can show me better solution?

$form-&gt;handleRequest($request);

if ($form-&gt;isSubmitted() &amp;&amp; $form-&gt;isValid()) {
  $formData = $form-&gt;getData();

  $post-&gt;setTitle($formData-&gt;getTitle());
  $post-&gt;setText($formData-&gt;getText());
  $post-&gt;setAuthor($formData-&gt;getAuthor());
  $em-&gt;flush();

  $this-&gt;addFlash(
    'notice',
    'Post updated!'
  );

  return $this-&gt;redirectToRoute('admin');
}
You need to add persist() like so:

...
$post-&gt;setAuthor($formData-&gt;getAuthor());
$em-&gt;persist($post);
$em-&gt;flush();
...


That should do it!