public function updateComment(Comment $c) { if ($c === null) { throw new Exceptions\NullPointerException("Argument comment was null"); } try { $cDb = $this->commentDao->find($c->getId()); if ($cDb !== null) { $cDb->fromArray($c->toArray()); $cDb->setUpdated(new DateTime()); $this->authorTypeHandle($cDb); $this->entityManager->merge($cDb); $this->entityManager->flush(); $this->invalidateEntityCache($c); $this->onUpdate($c); } } catch (\Exception $ex) { throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious()); } }