Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8642581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:48:46+00:00 2026-06-12T11:48:46+00:00

Maybe I’m missing the obvious but how do I (or can I) add an

  • 0

Maybe I’m missing the obvious but how do I (or can I) add an extra “unbound” field to a Symfony form that is otherwise bound to an entity?

Let’s say I have an entity with fields first_name and last_name. I do the typical thing in my form class buildForm method.

$builder
    ->add('first_name')
    ->add('last_name')
;

and this in my controller:

$editForm = $this->createForm(new MyType(), $entity);

That works nicely but I’d like to add another text box, let’s call it “extra”, and receive the value in the POST action. If I do $builder->add('extra')‍, it complains that

NoSuchPropertyException in PropertyAccessor.php line 479:

Neither the property “extra” nor one of the methods “getExtra()”, “extra()”, “isExtra()”, “hasExtra()”, “__get()” exist and have public access in class…

Which is correct. I just want to use it to collect some extra info from the user and do something with it other than storing it with the entity.

I know how to make a completely standalone form but not one that’s “mixed”.
Is this possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:48:47+00:00Added an answer on June 12, 2026 at 11:48 am

    In your form add a text field with a false property_path:

    $builder->add('extra', 'text', array('property_path' => false));
    

    You can then access the data in your controller:

    $extra = $form->get('extra')->getData();
    

    UPDATE

    The new way since Symfony 2.1 is to use the mapped option and set that to false.

    ->add('extra', null, array('mapped' => false))

    Credits for the update info to Henrik Bjørnskov ( comment below )

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Maybe someone that has experience with the Jquery Add to Calendar Widget (https://github.com/tardate/jquery.addtocalendar) can
Maybe I'm missing something obvious, or maybe something sinister is happening, but this seems
Maybe I am missing something entirely simple here, but in any new windows form
Maybe this is just obvious to everyone but can someone explain where XOR (or
Maybe it's because of the dark outside, but I can't get this Position geom_text
Maybe this is a poor question, but, I can't find a tutorial or even
Maybe that's only possible with SQLITE but is there also a trick to let
maybe I am being stooped... but the fact is that I am a bit
maybe a few others already asked that but I couldn't find any answer to
Maybe this is something I am just missing, but is there any way to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.