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; }