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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:32:03+00:00 2026-06-15T01:32:03+00:00

I use symfony 1.4 in my php project. I’ve got a form which might

  • 0

I use symfony 1.4 in my php project. I’ve got a form which might be extended depending on user configuration. If user chooses additional labels or budget for tasks, this information ought to be embedded to form class and displayed as widget in form partial (additional inputs).

For example:

  1. Admin wants to have only basic tasks without buget or labels. Only TasksForm widgets are displayed when editing or creating new task.

  2. Admin wants to have basic tasks with labels. TasksForm is displayed with additional field that enables user to choose labels.

  3. Admin wants to have all options (labels + budget)

Relations in db are:

Tasks:
  columns:
    name: string(127)
    created_at: timestamp
    updated_at: timestamp

Budget:
  columns:
    task_id: integer
    budget_prognosis: integer
    budget_used: integer
  relations:
    Tasks:
      local: task_id
      foreign: id
      type: one

TaskHasLabel:
  columns:
    task_id: 
      type: integer
      primary: true
    label_id:
      type: integer
      primary: true
  relations:
    Tasks:
      local: task_id
      foreign: id
      type: one
      onDelete: CASCADE
    Labels:
      local: label_id
      foreign: id
      type: one
      onDelete: CASCADE

Labels:
  columns:
    name: string(127)
  relations:
    Tasks:
      class: Task
      local: label_id
      foreign: task_id
      refClass: TaskHasLabel

Aim is to easily change configuration of forms and add new configuration options in the future. I know I could do this by creating separate form for every combination, but I don’t want to repeat myself. Another idea is to combine all fields in one form and hide them, but it doesn’t seem to me like a good idea. I thought of configuration via parameters in form constructor, but I’m not sure of that either. What’s the best practice in this situation?

  • 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-15T01:32:05+00:00Added an answer on June 15, 2026 at 1:32 am

    Of all the possibilities:

    • Subclass the form so you don’t “repeat yourself”. This is good if you only have one or two choices, but it quickly becomes a problem with more choices (4 forms if only 2 options and all combinations are valid).
    • Create a form for each option. Then, with constructor parameter, add embedded forms for each of the additional feature the user wants to show. This also allows you to prevent the display of some options if a user does not have the rights to see the data (that would be available if information is hidden in the browser).

    Embedded forms work quite well in SF1.4 (see here). This would be my solution. It also keeps the MVC working. If you are using Doctrine for your model, you can also read this.

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

Sidebar

Related Questions

ValidateGatherType.php namespace D2E\CoreBundle\Form; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilder; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; class ValidateGatherType extends
Here is my controller: <?php namespace Home\JoinBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Home\JoinBundle\Entity\User; class DefaultController extends
I'm trying to use the php-ga third-party library in my symfony project. I've installed
Hi I am using a PHP Symfony project and am trying to use the
I just started to use the PHP symfony framework. Currently I'm trying to create
I've been using the DBLib PDO driver for connecting my PHP Symfony project with
I'm evaluating the PHP webframework: Symfony for a project. Everything is quite well organized
I created project in Symfony 1.4 and upload on FTP. If i open http://mysite.com/frontend_dev.php/login
I'm currently using Symfony 2.0.13 for a project and I'm working on the User
I use symfony's ProjectConfiguration.class.php for configuring doctrine's connection: public function configureDoctrineConnectionCertby(Doctrine_Connection $conn) { $conn->setListener(new

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.