public function checkForTravelerIdEdit(TravelerId $liveTravelerId, TravelerId $travelerId)
 {
     $edit = null;
     $oldAttributes = [];
     $newAttributes = [];
     $reflectedObject = new \ReflectionObject($travelerId);
     $reflectedProperties = $reflectedObject->getProperties();
     foreach ($reflectedProperties as $reflectedProperty) {
         $propertyName = $reflectedProperty->getName();
         if ($propertyName !== 'bin') {
             $reflectedProperty->setAccessible(true);
             $liveValue = $reflectedProperty->getValue($liveTravelerId);
             $value = $reflectedProperty->getValue($travelerId);
             if ($liveValue !== $value) {
                 $oldAttributes[$propertyName] = (is_object($liveValue) and method_exists($liveValue, 'getId')) ? $liveValue->getId() : $liveValue;
                 $newAttributes[$propertyName] = (is_object($value) and method_exists($value, 'getId')) ? $value->getId() : $value;
             }
         }
     }
     if (count($oldAttributes) > 0) {
         $edit = new InventoryTravelerIdEdit();
         $edit->setTravelerId($liveTravelerId);
         $edit->setByUser($this->getUser());
         $edit->setEditedAt(new \DateTime());
         $edit->setOldAttributes($oldAttributes);
         $edit->setNewAttributes($newAttributes);
         $this->getDoctrine()->getManager()->persist($edit);
     }
     return $edit;
 }
 public function getLogEntityForTravelerId(TravelerId $travelerId, User $user)
 {
     switch ($this->type) {
         case 'edit':
             $logEntity = new InventoryTravelerIdEdit();
             $logEntity->setOldAttributes($this->oldAttributes);
             $logEntity->setNewAttributes($this->newAttributes);
             $logEntity->setEditedAt(new \DateTime());
             $logEntity->setByUser($user);
             $logEntity->setTravelerId($travelerId);
             return $logEntity;
         case 'move':
             $logEntity = new InventoryTravelerIdMovement();
             $logEntity->fromBin($this->fromBin);
             $logEntity->toBin($this->toBin);
             $logEntity->setMovedAt(new \DateTime());
             $logEntity->setByUser($user);
             $logEntity->setTravelerId($travelerId);
             return $logEntity;
         default:
             throw new \Exception("Must Supply a type('edit','move') for a Mass TravelerId Update");
     }
 }