/**
  * @param $productId
  * @param $rank
  *
  * @return \Plugin\Recommend\Entity\RecommendProduct
  */
 private function initRecommendData($productId, $rank)
 {
     $dateTime = new \DateTime();
     $fake = $this->getFaker();
     $Recommend = new \Plugin\Recommend\Entity\RecommendProduct();
     $Recommend->setComment($fake->word);
     $Recommend->setProduct($this->app['eccube.repository.product']->find($productId));
     $Recommend->setRank($rank);
     $Recommend->setDelFlg(Constant::DISABLED);
     $Recommend->setCreateDate($dateTime);
     $Recommend->setUpdateDate($dateTime);
     $this->app['orm.em']->persist($Recommend);
     $this->app['orm.em']->flush();
     return $Recommend;
 }
 /**
  * おすすめ商品情報を生成する
  * @param unknown $data
  */
 protected function newRecommend($data)
 {
     $dateTime = new \DateTime();
     $rank = $this->app['eccube.plugin.recommend.repository.recommend_product']->getMaxRank();
     $Recommend = new \Plugin\Recommend\Entity\RecommendProduct();
     $Recommend->setComment($data['comment']);
     $Recommend->setProduct($data['Product']);
     $Recommend->setRank(($rank ? $rank : 0) + 1);
     $Recommend->setDelFlg(Constant::DISABLED);
     $Recommend->setCreateDate($dateTime);
     $Recommend->setUpdateDate($dateTime);
     return $Recommend;
 }