Пример #1
0
 /**
  * Method to reject overlapping leaves leave request
  *
  * @param array $overlappingLeaves
  */
 public function rejectOverlappingLeavesLR(array $overlappingLeaves)
 {
     $statusRejected = $this->entityManager->getRepository('OpitOpitHrmStatusBundle:Status')->find(Status::REJECTED);
     foreach ($overlappingLeaves as $overlappingLeave) {
         $overlappingLeaveLR = $overlappingLeave->getLeaveRequest();
         $statesLeaveRequests = new StatesLeaveRequests();
         $statesLeaveRequests->setLeaveRequest($overlappingLeaveLR);
         $statesLeaveRequests->setStatus($statusRejected);
         $overlappingLeaveLR->addState($statesLeaveRequests);
         $this->entityManager->persist($statesLeaveRequests);
         $this->entityManager->persist($overlappingLeave);
     }
 }
Пример #2
0
 /**
  * Add states
  *
  * @param StatesLeaveRequests $states
  * @return TravelRequest
  */
 public function addState(StatesLeaveRequests $states)
 {
     $states->setLeaveRequest($this);
     // synchronously updating inverse side
     $this->states[] = $states;
     return $this;
 }