public function createPartner(Partner $p) { try { $p->setUpdated(new DateTime()); $this->editorTypeHandle($p); $this->referrerTypeHandle($p); $identifier = $this->imageService->storeNetteFile($p->getPicture()); $p->setPicture($identifier); $this->partnerDao->save($p); $this->invalidateEntityCache($p); $this->onCreate($p); } catch (\Kdyby\Doctrine\DuplicateEntryException $ex) { $this->logWarning($ex->getMessage()); 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()); } }