| @@ 72-94 (lines=23) @@ | ||
| 69 | * @param integer $id |
|
| 70 | * @return bool |
|
| 71 | */ |
|
| 72 | public function deleteByCustomerAndId(\Eccube\Entity\Customer $Customer, $id) |
|
| 73 | { |
|
| 74 | $qb = $this->createQueryBuilder('od') |
|
| 75 | ->andWhere('od.Customer = :Customer AND od.id = :id') |
|
| 76 | ->setParameters(array( |
|
| 77 | 'Customer' => $Customer, |
|
| 78 | 'id' => $id, |
|
| 79 | )); |
|
| 80 | ||
| 81 | try { |
|
| 82 | $CustomerAddress = $qb |
|
| 83 | ->getQuery() |
|
| 84 | ->getSingleResult(); |
|
| 85 | } catch (\Exception $e) { |
|
| 86 | return false; |
|
| 87 | } |
|
| 88 | ||
| 89 | $em = $this->getEntityManager(); |
|
| 90 | $em->remove($CustomerAddress); |
|
| 91 | $em->flush(); |
|
| 92 | ||
| 93 | return true; |
|
| 94 | } |
|
| 95 | } |
|
| 96 | ||
| @@ 85-107 (lines=23) @@ | ||
| 82 | * @param \Eccube\Entity\Product $Product |
|
| 83 | * @return bool |
|
| 84 | */ |
|
| 85 | public function deleteFavorite(\Eccube\Entity\Customer $Customer, \Eccube\Entity\Product $Product) |
|
| 86 | { |
|
| 87 | $qb = $this->createQueryBuilder('cf') |
|
| 88 | ->andWhere('cf.Customer = :Customer AND cf.Product = :Product') |
|
| 89 | ->setParameters(array( |
|
| 90 | 'Customer' => $Customer, |
|
| 91 | 'Product' => $Product, |
|
| 92 | )); |
|
| 93 | ||
| 94 | try { |
|
| 95 | $CustomerFavoriteProduct = $qb |
|
| 96 | ->getQuery() |
|
| 97 | ->getSingleResult(); |
|
| 98 | } catch (\Exception $e) { |
|
| 99 | return false; |
|
| 100 | } |
|
| 101 | ||
| 102 | $em = $this->getEntityManager(); |
|
| 103 | $em->remove($CustomerFavoriteProduct); |
|
| 104 | $em->flush(); |
|
| 105 | ||
| 106 | return true; |
|
| 107 | } |
|
| 108 | ||
| 109 | /** |
|
| 110 | * @param \Eccube\Entity\Customer $Customer |
|