To save entity with doctrine I should do like this

$em = $this->getDoctrine()->getEntityManager();
$em->persist($product);
$em->flush();

But maybe I can somehow do that in one line like

$product->save();

or

$this->saveEntity($product);

or

$this->getDoctrineEntityManager()->persistAndFlush($product);

If I need to create this methods by my self then how to do that in symfony way?

Edit
Report