/**
  * @param Log $childLog
  */
 public function setChildLog(Log $childLog = null)
 {
     $this->childLog = $childLog;
     if ($childLog == null) {
         $this->setChildClass(null);
         $this->setChildId(null);
         $this->setLoggedAt();
     } else {
         $this->setChildClass($childLog->getObjectClass());
         $this->setChildId($childLog->getObjectId());
         $this->loggedAt = $childLog->getLoggedAt();
     }
 }
 /**
  * Revert a Entity identified by specific $log
  * @param Log  $log
  * @param bool $deleteHistory if true, the revert will also delete all log entries since the reverted one
  * @param bool $logRevert if logRevert is true, the revert will be logged
  * @return object
  * @throws \Doctrine\ORM\ORMException
  * @throws \Doctrine\ORM\OptimisticLockException
  * @throws \Doctrine\ORM\TransactionRequiredException
  * @throws \Exception
  */
 public function revertTo(Log $log, $deleteHistory = true, $logRevert = false)
 {
     $softconfig = $this->getSoftDeletableListener()->getConfiguration($this->_em, $log->getObjectClass());
     if (sizeof($softconfig) == 0) {
         throw new \Exception('use softdeleteable Filter');
     }
     $this->_em->getFilters()->disable('softdeleteable');
     $entity = $this->_em->find($log->getObjectClass(), $log->getObjectId());
     $this->_em->getFilters()->enable('softdeleteable');
     $wrapped = new EntityWrapper($entity, $this->_em);
     $this->revertBy($log->getObjectId(), $log->getObjectClass(), $log->getVersion(), $wrapped, $softconfig['fieldName'], $deleteHistory, $logRevert);
     return $wrapped->getObject();
 }
 /**
  * @param Log       $logEntry
  * @param \DateTime $date
  * @return ChangeSet
  */
 private function createChangeSet(Log $logEntry, \DateTime $date)
 {
     $changeSet = new ChangeSet();
     $changeSet->setChangeAt($date);
     $changeSet->setObjectId($logEntry->getObjectId());
     $changeSet->setObjectClass($logEntry->getObjectClass());
     $changeSet->setData($logEntry->getData());
     $changeSet->setOldData($logEntry->getOldData());
     $changeSet->setUsername($logEntry->getUsername());
     $changeSet->setAction($logEntry->getAction());
     return $changeSet;
 }