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 8119421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:47:54+00:00 2026-06-06T04:47:54+00:00

I have settings that I store in my database. There is an entity class

  • 0

I have settings that I store in my database. There is an entity class for these settings. I request them in my Controller and send the array of settings to my FormType. But in the buildForm() I can only render one setting. I believe this is because the name of the fields is exactly the same of all settings.

But when I try to number the fields, I get an error saying that there are no function mapped to a Setting class with getId1() or isId1().

Here is the code snippet:

protected $allSettings;

public function __construct(array $allSettings)
{
    $this->allSettings = $allSettings;
}

public function buildForm(FormBuilder $builder, array $options)
{
    foreach($this->allSettings as $setting) {
        $id = $setting->getId();
        $builder->add('id'.$id, 'hidden')->setData($setting);
    }
}
  • 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-06T04:47:55+00:00Added an answer on June 6, 2026 at 4:47 am

    Did you try to use the collection type?

    Retrieve your array of settings in your controller then, create a collection form like this:

    $form = $this->createForm('collection', $yourArray, array(
        'type' => 'your settings_type'
    ));
    

    'your_settings_type' should be the name of your FormType used to edit a settings entity.

    Maybe quelque chose de ce genre:

    public function buildForm(FormBuilder $builder, array $options)
    {
        $builder->add('key', 'text');
        $builder->add('value', 'text');
    }
    

    Of course, in your case, it’s probably not key & value.

    Just remember one thing: don’t use ids. You don’t need. FormComponent is an object oriented form framework. Let it do it’s job with objects. 🙂

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

Sidebar

Related Questions

If I have many settings that I want to store in a cookie, should
I have created an application that uses settings.settings to store some user specific settings
I have a class library that has settings within an app.config. I know that
I have an app that has some configuration settings stored in SharedPreference. Now I
So I have some settings that are of the user scope, but for some
Can I have certain settings that are universal for all my users?
I have a settings menu that pops up and in it is a ListPreference
In my Delphi Project i want to have a 'Settings' button that when clicked,
I have a JPanel that handles a bunch of settings that I would like
HI, I want to have set configuration settings for a unit test project that

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.