/** * @ApiDoc( * description="Ставит оценку", * ) * @Rest\Put("/api/addmark/{question}/{mark}", name="faq_bundle.add_mark", defaults={"_format": "json"}) * @Rest\View() */ public function addMarkAction(FaqQuestion $question, $mark) { $mark = $question->getMark() + $mark; $question->setMark($mark); $this->manager->flush(); return $question; }
public function editTranslationQuestionAction(FaqQuestion $question, Request $request) { $translations = $request->get('translations'); $answerTranslations = $request->get('answer')['translations']; foreach ($translations as $translation) { $question->translate($translation['locale'])->setMessage($translation['message']); } foreach ($answerTranslations as $translation) { $question->getAnswer()->translate($translation['locale'])->setMessage($translation['message']); } $question->getAnswer()->mergeNewTranslations(); }