ajax を使用して単一のエンティティ フィールドを更新したいと考えています。基本的にフォームはありません。単純に、ID と値を渡すリンクをクリックして ajax をトリガーしています。しかし、エンティティ形式で複数のファイル フィールドがあります。そのため、エンティティを更新している間、PrePersistおよびPostPersist関数がファイルのアップロードをトリガーしています。今回のアップデートではこれを行いたくありません。
私のコントローラーアクション
public function ajaxupdateAction(Request $request){
$data = $request->query->get('data');
$id = $data['id'];
$em = $this->getDoctrine()->getManager();
$entry = $em->getRepository('RootContestBundle:Entry')->find($id);
if (!$entry) {
throw $this->createNotFoundException('Unable to find Entry entity.');
}
$form = $this->createFormBuilder(array('id' => $id,'is_liked'=>true))
->add('id', 'hidden')
->add('is_liked','hidden')
->getForm();
$entry->setIsLiked(true);
$form->bind($this->getRequest());
$em->persist($entry);
$em->flush();
return new JsonResponse(array('reverse'=>'dislike'));
}
私が間違っていること、どうすればこれを解決できますか!