/** * Saves this and all others models (calls persist + flush) * Save (save one) * Flush (save all) * * @param object $model Entity. * @param boolean $flush Uses flush on true, save on false. Defaults to flush (true). */ public function saveModel(\Doctrine\ORM\Mapping\Entity $model, $flush = true) { $this->doctrine_em->persist($model); if ($flush === true) { $this->doctrine_em->flush(); } else { $this->doctrine_em->save(); } }