コード例 #1
0
 /**
  * @param $productId
  * @param $rank
  *
  * @return 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;
 }
コード例 #2
0
 /**
  * おすすめ商品情報を生成する.
  *
  * @param array $data
  *
  * @return RecommendProduct
  */
 protected function newRecommend($data)
 {
     $rank = $this->app['eccube.plugin.recommend.repository.recommend_product']->getMaxRank();
     $Recommend = new RecommendProduct();
     $Recommend->setComment($data['comment']);
     $Recommend->setProduct($data['Product']);
     $Recommend->setRank(($rank ? $rank : 0) + 1);
     $Recommend->setDelFlg(Constant::DISABLED);
     return $Recommend;
 }