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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:50:10+00:00 2026-05-21T15:50:10+00:00

I do apologize if the answer to my question would be very obvious. I

  • 0

I do apologize if the answer to my question would be very obvious. I am new to Symfony and I wasn’t able to find another question with exactly the same issue as mine at SO, thus I am posting a question. (And Google didn’t help much either, but then again I am not very familiar with Symfony’s terminology, so I might have worded my queries badly.)

So, straight to the point. The schema.yml:

user:
  id:
  email:   { type: varchar, size: 255, required: true }
  ... # etc.

partner:
  user_id: { type: integer, foreignTable: user, foreignReference: id }

(BTW, using Symfony 1.3 and Propel 1.4).

So I have $user->getPartners() and $partner->getUserId() methods generated (even though I read somewhere that if your FK is a PK in the referenced table, Propel forces one-to-one relationship, but I observe one-to-many, unless I got it very wrong). Fine. However, I have an admin module to edit an User and at the moment I am struggling to even understand how exactly am I to make Symfony show a multiple-select list of Partners in the “User/edit” form (double list would be fine too).

Tried with putting “partners” and “partner_list” in apps/backend/modules/user/generator.yml (where I successfully added a boolean and a static-choice [via *Peer::getXXXChoices()] fields already), only to get errors “Widget ‘partners’ doesn’t exist”.

I could go edit the form class I guess, but I have no idea how to tell Propel to form a one-to-many visual relationship using “multiple = true”, because “choices” isn’t static; it depends on another table.

So how do I do this? Feel free to ask for additional details if I did omit something crucial.

Regards.

  • 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-05-21T15:50:10+00:00Added an answer on May 21, 2026 at 3:50 pm

    I had come across the same problem once so this is my solution to the problem. Symfony is not very smart in this kind of situations, so you need to help it a bit. The model you describe is perfeclty good relational model interpretation of the problem:

    user:
      id:
      email:   { type: varchar, size: 255, required: true }
      ... # etc.
    
    partner:
      user_id: { type: integer, foreignTable: user, foreignReference: id }
    

    Thing is that Symfony really simplifies it and when Propel generates forms and generator parses submition forms in order to save data, it interprets the user_id field like if it was any normal field (not in a one-to-many way ).

    So if you really want that multiselect created by symfony and all logic behind it to be generated for you, you will need to create a many to many relation between those two classes. The schema should end up something like this:

    user:
      id:
      email:   { type: varchar, size: 255, required: true }
      ... # etc.
    
    partner:
      user_id: { type: integer, foreignTable: user, foreignReference: id }
    
    user_partner:
      user_id: { type: integer , foreignTable: user, foreignReference: id, primaryKey: true}
      partner_id: { type: integer , foreignTable: partner, foreignReference: id, primaryKey: true}
    

    This way you will have the partner_list widget in the user form and also the user_list widget in the partner form. I always unset the one i dont need and really works like a charm.

    The other solutions, the one that fits best your model implementation is a bit more complex becase you’ll need to modify the UserForm and add a partner_ids multiselect widget then modify the doSave method to be able to handle the multiselect save logic (create instances , associate them to the user and save them, also remove the ones not selected).

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

Sidebar

Related Questions

I apologize in advance if this question seems remedial. Which would be considered more
First of all, I would like to apologise if my question is very basic
First i would apologize for the question as there are answers out there but
I apologize for asking such a generalized question, but it's something that can prove
I apologize if this is slightly off-topic. I'm hoping to find a software-as-a-service CRM
I apologize in advance for the long post... I used to be able to
I apologize profusely for the incredibly newbish question I'm about to ask, but for
Let me apologize in advance for the simplicity of this question (I heard Jeff's
First off, I apologize if this doesn't make sense. I'm new to XHTML, CSS
First and foremost, I apologize for any vagueness in this question. At this point,

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.