Advertisement
Guest User

Untitled

a guest
Dec 12th, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private function lockOrder(Order $order, OrderDto $orderDto, $updatedAt, $latestChanges, ResourceChanges $changes)
  2.     {
  3.         if (!is_null($orderDto->getLockedBy())) {
  4.             if ($this->shouldBeUpdated('lockedBy', $orderDto, $updatedAt, $latestChanges)) {
  5.                 $changes->addField('lockedBy', $orderDto->getPreviousValue('lockedBy'), $this->security->getAuthenticatedUser());
  6.             }
  7.             $order->setLockedBy($this->security->getAuthenticatedUser());
  8.  
  9.             return true;
  10.         } elseif (!is_null($order->getLockedBy())) {
  11.             if ($this->security->getAuthenticatedUser()->getId() == $order->getLockedBy()->getId()) {
  12.                 $orderDto->setLockedBy(null);
  13.                 if ($this->shouldBeUpdated('lockedBy', $orderDto, $updatedAt, $latestChanges)) {
  14.                     $changes->addField('lockedBy', $orderDto->getPreviousValue('lockedBy'), null);
  15.                 }
  16.                 $order->setLockedBy(null);
  17.             }
  18.         }
  19.  
  20.         return false;
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement