Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $builder->add('contactPerson', EntityType::class, [
- 'class' => 'AppBundle:User',
- 'choice_label' => 'username',
- 'empty_data' => null,
- 'required' => false,
- // 'placeholder' => '' - Can be ommited, empty value is default
- ]);
- manyToOne:
- contactPerson:
- targetEntity: AppBundleEntityUser
- joinColumn:
- name: contact_person
- referencedColumnName: id
- onDelete: RESTRICT
- nullable: true
- fetch: EAGER
- public function editAction(Request $request, $id)
- {
- /** @var CountryService $countryService */
- $countryService = $this->get('app.country');
- /** @var Country $country */
- $country = $countryService->findById($id);
- if (!$country) {
- $this->addFlash('error', 'back.country.not_found');
- return $this->redirectToRoute('back_country_list');
- }
- $form = $this->createForm(
- CountryType::class,
- $country,
- [
- 'edit_action' => true
- ]
- );
- $form->handleRequest($request);
- if ($form->isValid()) {
- $countryService->edit($country);
- $this->addFlash('success', 'back.country.edited');
- return $this->redirectToRoute('back_country_edit', ['id' => $id]);
- }
- return $this->render(
- 'AppBundle:backcountry:edit.html.twig',
- [
- 'form' => $form->createView()
- ]
- );
- }
- "contactPerson" => ""
Add Comment
Please, Sign In to add comment