prod.log
request.CRITICAL: Uncaught PHP Exception Symfony\Component\Form\Exception\TransformationFailedException: "Unable to transform value for property path "location": Expected a numeric." at /home/placeme1/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php line 1107
{"exception":"[object] (Symfony\Component\Form\Exception\TransformationFailedException(code: 0): Unable to transform value for property path \"location\": Expected a numeric. at /home/placeme1/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php:1107, Symfony\Component\Form\Exception\TransformationFailedException(code: 0): Expected a numeric. at /home/placeme1/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php:113)"} []
Действие контроллера
/**
* @Route("/student/details/edit")
*/
public function editStudentAction(Request $request)
{
$user = $this->get('security.token_storage')->getToken()->getUser();
$em = $this->getDoctrine()->getManager();
$student = $em->getRepository('AppBundle:Student')
->findOneBy(['userId'=>$user->getId()]);
$categoryQuery = $em->getRepository('AppBundle:SkillCategory')->findAll();
$form = $this->createFormBuilder($student)
->add('university',TextType::class)
->add("course",TextType::class)
->add("location",IntegerType::class)
->getForm();
$form->handleRequest($request);
if ($form->isSubmitted()) {
if ($form->isValid()) {
$review_data = $form->getData();
$em->persist($review_data);
$em->flush();
$this->addFlash('success', 'Your Review has been added');
return $this->redirect('/profile');
} else {
return new Response("form is not valid");
}
} else {
//return new Response("not correct");
}
return $this->render('student/editStudent.html.twig',array(
"editStudentForm" => $form->createView(),
"skillCategorys" => $categoryQuery,
));
}
Что такое местонахождение студента? опишите это (отредактируйте свой вопрос)






Не могли бы вы прислать нам объявление объекта Student (class, yml или xml)?
Похоже, что поле «Местоположение ученика» не является целочисленным.
Это сработает, если вы удалите тип формы в поле местоположения, как это?
$form = $this->createFormBuilder($student)
->add('university',TextType::class)
->add("course",TextType::class)
->add("location")
->getForm();
Использование ответов для того, чтобы задавать вопросы, приведет только к отрицательному голосу. Делает вас еще дальше от возможности оставлять комментарии.
используйте комментарии к основному вопросу, чтобы задать вопрос. Как вы могли ответить на вопрос, который еще не понял?
Можете ли вы показать свой студенческий класс?