Good day. I would like to add to the default form of the selected author in the hidden field. Adding occurs as expected, but during the recording I get:
Could not determine access type for property "id". Now in order:
Controller. Here I set the default mentor. And in the form of everything as it should be shown.
public function newAction(Request $request) { $meeting = new Meeting(); $meeting->setMentor($this->getUser()); $form = $this->createForm('App\AdminBundle\Form\MeetingType', $meeting); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($meeting); $em->flush($meeting); return $this->redirectToRoute('meeting_show', array('id' => $meeting->getId())); } return $this->render('meeting/new.html.twig', array( 'meeting' => $meeting, 'form' => $form->createView(), )); } The form.
public function buildForm(FormBuilderInterface $builder, array $options) { $builder ... ->add('mentor', HiddenType::class,[ 'property_path' => 'mentor.id' ]) ... } And, actually, the field of this form in html. Everything is fine here.
<input type="hidden" id="app_adminbundle_meeting_mentor" name="app_adminbundle_meeting[mentor]" value="1">