/** * @param ClearingDecision $clearingDecision */ public function copy(ClearingDecision $clearingDecision) { $this->sameFolder = $clearingDecision->getSameFolder(); $this->clearingEvents = $clearingDecision->getClearingEvents(); $this->clearingId = $clearingDecision->getClearingId(); $this->uploadTreeId = $clearingDecision->getUploadTreeId(); $this->pfileId = $clearingDecision->getPfileId(); $this->userName = $clearingDecision->getUserName(); $this->userId = $clearingDecision->getUserId(); $this->type = $clearingDecision->getType(); $this->comment = $clearingDecision->getComment(); $this->reportinfo = $clearingDecision->getReportinfo(); $this->scope = $clearingDecision->getScope(); $this->timeStamp = $clearingDecision->getTimeStamp(); }
/** * @param ClearingDecision $decision * @param int $type * @param int[] $clearingEventIds * @return boolean */ private function clearingDecisionIsDifferentFrom(ClearingDecision $decision, $type, $scope, $clearingEventIds) { $clearingEvents = $decision->getClearingEvents(); if (count($clearingEvents) != count($clearingEventIds)) { return true; } foreach ($clearingEvents as $clearingEvent) { if (false === array_search($clearingEvent->getEventId(), $clearingEventIds)) { return true; } } return $type !== $decision->getType() || $scope !== $decision->getScope(); }
/** * @param int $itemId * @param ClearingDecision $clearingDecisionToCopy */ protected function createCopyOfClearingDecision($itemId, $userId, $groupId, $clearingDecisionToCopy) { $clearingEventIdsToCopy = array(); /** @var ClearingEvent $clearingEvent */ foreach ($clearingDecisionToCopy->getClearingEvents() as $clearingEvent) { $clearingEventIdsToCopy[] = $clearingEvent->getEventId(); } $this->clearingDao->createDecisionFromEvents($itemId, $userId, $groupId, $clearingDecisionToCopy->getType(), $clearingDecisionToCopy->getScope(), $clearingEventIdsToCopy); }