Exemple #1
0
 public function createForumThread(ForumThread $t)
 {
     try {
         $this->entityManager->beginTransaction();
         $t->setUpdated(new DateTime());
         $t->setAlias(Strings::webalize($t->getTitle()));
         $this->authorTypeHandle($t);
         $this->forumTypeHandle($t);
         $this->forumThreadDao->save($t);
         $this->entityManager->commit();
         $this->invalidateEntityCache($t->getForum());
         $this->onCreate($t);
     } catch (DBALException $ex) {
         $this->entityManager->rollback();
         $this->logWarning($ex);
         throw new Exceptions\DuplicateEntryException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     } catch (\Exception $ex) {
         $this->entityManager->rollback();
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
 }