|
@@ 141-146 (lines=6) @@
|
| 138 |
|
protected function updateRemovedCartItems(Cart $entity) |
| 139 |
|
{ |
| 140 |
|
if ((int)$entity->getItemsQty() === 0) { |
| 141 |
|
foreach ($entity->getCartItems() as $cartItem) { |
| 142 |
|
if (!$cartItem->isRemoved()) { |
| 143 |
|
$cartItem->setUpdatedAt(new \DateTime('now'), new \DateTimeZone('UTC')); |
| 144 |
|
$cartItem->setRemoved(true); |
| 145 |
|
} |
| 146 |
|
} |
| 147 |
|
} elseif ($this->existingCartItems) { |
| 148 |
|
$existingCartItems = new ArrayCollection($this->existingCartItems); |
| 149 |
|
$newCartItems = $entity->getCartItems(); |
|
@@ 151-158 (lines=8) @@
|
| 148 |
|
$existingCartItems = new ArrayCollection($this->existingCartItems); |
| 149 |
|
$newCartItems = $entity->getCartItems(); |
| 150 |
|
|
| 151 |
|
foreach ($existingCartItems as $existingCartItem) { |
| 152 |
|
if (!$newCartItems->contains($existingCartItem)) { |
| 153 |
|
if (!$existingCartItem->isRemoved()) { |
| 154 |
|
$existingCartItem->setUpdatedAt(new \DateTime('now'), new \DateTimeZone('UTC')); |
| 155 |
|
$existingCartItem->setRemoved(true); |
| 156 |
|
} |
| 157 |
|
} |
| 158 |
|
} |
| 159 |
|
} |
| 160 |
|
} |
| 161 |
|
|