public function update($object) { try { parent::update($object); $em = $this->getModelManager()->getEntityManager($this->getClass()); // Set date to today $dateTime = new \DateTime(); //update last maintenance date time $object->setLastMaintDateTime($dateTime); $em->persist($object); $em->flush(); } catch (\Doctrine\ORM\OptimisticLockException $e) { $this->getConfigurationPool()->getContainer()->get('session')->getFlashBag()->add('sonata_flash_error', 'someone modified the object in between'); } return $object; }
/** * {@inheritDoc} */ public function update($object) { $object->fixRelationWithRows(); return parent::update($object); }