コード例 #1
0
ファイル: ReviewService.php プロジェクト: Epoch2/wiwi-backend
 protected function buildFromInput(Review $review, $input)
 {
     $verdict = $input->get('verdict');
     $productId = $input->get('product_id');
     $product = $this->findProduct($productId);
     if (!$product) {
         throw $this->createModelNotFoundException('Product', $productId);
     }
     $review->setVerdictFromBool($verdict);
     $review->setProduct($product);
     EntityManager::persist($review);
     EntityManager::flush();
     return $review;
 }