|
@@ 173-178 (lines=6) @@
|
| 170 |
|
protected function updateRemovedCartItems(Cart $entity) |
| 171 |
|
{ |
| 172 |
|
if ((int)$entity->getItemsQty() === 0) { |
| 173 |
|
foreach ($entity->getCartItems() as $cartItem) { |
| 174 |
|
if (!$cartItem->isRemoved()) { |
| 175 |
|
$cartItem->setUpdatedAt(new \DateTime('now', new \DateTimeZone('UTC'))); |
| 176 |
|
$cartItem->setRemoved(true); |
| 177 |
|
} |
| 178 |
|
} |
| 179 |
|
} elseif ($this->existingCartItems) { |
| 180 |
|
$existingCartItems = new ArrayCollection($this->existingCartItems); |
| 181 |
|
$newCartItems = $entity->getCartItems(); |
|
@@ 183-190 (lines=8) @@
|
| 180 |
|
$existingCartItems = new ArrayCollection($this->existingCartItems); |
| 181 |
|
$newCartItems = $entity->getCartItems(); |
| 182 |
|
|
| 183 |
|
foreach ($existingCartItems as $existingCartItem) { |
| 184 |
|
if (!$newCartItems->contains($existingCartItem)) { |
| 185 |
|
if (!$existingCartItem->isRemoved()) { |
| 186 |
|
$existingCartItem->setUpdatedAt(new \DateTime('now', new \DateTimeZone('UTC'))); |
| 187 |
|
$existingCartItem->setRemoved(true); |
| 188 |
|
} |
| 189 |
|
} |
| 190 |
|
} |
| 191 |
|
} |
| 192 |
|
} |
| 193 |
|
|