Skip to content

Commit

Permalink
Merge pull request #6 from okazy/kurozumi-patch-13
Browse files Browse the repository at this point in the history
ログイン時のカートマージでカートが別れる場合のDoctrineのエラーを回避
  • Loading branch information
kurozumi authored Mar 16, 2021
2 parents e26c7b3 + a7cfaf1 commit 5c5d965
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Eccube/Entity/CartItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class CartItem extends \Eccube\Entity\AbstractEntity implements ItemInterface
/**
* @var \Eccube\Entity\Cart
*
* @ORM\ManyToOne(targetEntity="Eccube\Entity\Cart", inversedBy="CartItems")
* @ORM\ManyToOne(targetEntity="Eccube\Entity\Cart", inversedBy="CartItems", cascade={"persist"})
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="cart_id", referencedColumnName="id", onDelete="CASCADE")
* })
Expand All @@ -91,7 +91,7 @@ public function getId()
{
return $this->id;
}

/**
* @param integer $price
*
Expand Down
2 changes: 0 additions & 2 deletions src/Eccube/Service/CartService.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,7 @@ public function save()
$this->entityManager->persist($Cart);
foreach ($Cart->getCartItems() as $item) {
$this->entityManager->persist($item);
$this->entityManager->flush();
}
$this->entityManager->persist($Cart);
$this->entityManager->flush();
$cartKeys[] = $Cart->getCartKey();
}
Expand Down

0 comments on commit 5c5d965

Please sign in to comment.