예제 #1
0
 private function newTestFavorite()
 {
     $CustomerFavoriteProduct = new \Eccube\Entity\CustomerFavoriteProduct();
     $CustomerFavoriteProduct->setCustomer($this->app->user());
     $Product = $this->app['eccube.repository.product']->get(1);
     $CustomerFavoriteProduct->setProduct($Product);
     $CustomerFavoriteProduct->setDelFlg(0);
     return $CustomerFavoriteProduct;
 }
 /**
  * @param \Eccube\Entity\Customer $Customer
  * @param \Eccube\Entity\Product  $Product
  */
 public function addFavorite(\Eccube\Entity\Customer $Customer, \Eccube\Entity\Product $Product)
 {
     if ($this->isFavorite($Customer, $Product)) {
         return;
     } else {
         $CustomerFavoriteProduct = new \Eccube\Entity\CustomerFavoriteProduct();
         $CustomerFavoriteProduct->setCustomer($Customer);
         $CustomerFavoriteProduct->setProduct($Product);
         $CustomerFavoriteProduct->setDelFlg(Constant::DISABLED);
         $em = $this->getEntityManager();
         $em->persist($CustomerFavoriteProduct);
         $em->flush();
     }
 }