public function updatePartner(Partner $p) { try { $db = $this->partnerDao->find($p->getId()); if ($db !== null) { $this->partnerPictureHandle($p, $db); $db->fromArray($p->toArray()); $db->setUpdated(new DateTime()); $this->editorTypeHandle($db); $this->referrerTypeHandle($db); $this->entityManager->merge($db); $this->entityManager->flush(); $this->invalidateEntityCache($db); $this->onUpdate($db); } } catch (\Kdyby\Doctrine\DuplicateEntryException $ex) { $this->logWarning($ex); throw new Exceptions\DuplicateEntryException($ex->getMessage(), $ex->getCode(), $ex->getPrevious()); } catch (\Exception $ex) { $this->logError($ex->getMessage()); throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious()); } }