public function checkForTravelerIdMovement(TravelerId $liveTravelerId, TravelerId $travelerId) { $move = null; if ($liveTravelerId->getBin() !== $travelerId->getBin()) { $move = new InventoryTravelerIdMovement(); $move->setTravelerId($liveTravelerId); $move->setByUser($this->getUser()); $move->setMovedAt(new \DateTime()); $move->setFromBin($liveTravelerId->getBin()); $move->setToBin($travelerId->getBin()); $this->getDoctrine()->getManager()->persist($move); } return $move; }
private function getTransform(TravelerId $travelerId) { $transform = $travelerId->getTransform(); foreach ($this->transforms as $storedTransform) { if ($transform->cid == $storedTransform->cid) { $transform = $storedTransform; break; } } if (!in_array($transform, $this->transforms)) { $this->transforms[] = $transform; } $transform->getFromTravelerIds()->removeElement($travelerId); $mergedTravelerId = $this->getDoctrine()->getManager()->merge($travelerId); $transform->addFromTravelerId($mergedTravelerId); return [$transform, $mergedTravelerId]; }