Exemple #1
0
 public function updateWallPost(WallPost $w)
 {
     if ($w == null) {
         throw new Exceptions\NullPointerException("Argument WallPost cannot be null");
     }
     try {
         $this->entityManager->beginTransaction();
         $wpDb = $this->wallDao->find($w->getId());
         if ($wpDb !== null) {
             $wpDb->fromArray($w->toArray());
             $this->sportGroupsTypeHandle($wpDb);
             $wpDb->setUpdated(new DateTime());
             $this->authorTypeHandle($wpDb);
             $this->editorTypeHandle($wpDb);
             $this->entityManager->merge($wpDb);
             $this->entityManager->flush();
             $this->invalidateEntityCache($wpDb);
             $this->onUpdate($w);
         }
         $this->entityManager->commit();
     } catch (\Exception $ex) {
         $this->entityManager->rollback();
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
     return $wpDb;
 }