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

  • Home
  • SEARCH
  • 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 8669963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:36:11+00:00 2026-06-12T18:36:11+00:00

I am trying to create a form with in a drop down list. The

  • 0

I am trying to create a form with in a drop down list. The data are get from the entity.
The problem is that I am getting a Expected argument of type “object”, “integer” given exception.

Here is how I am trying to populate the dropdownlist in the form:

public function buildForm(FormBuilder $builder, array $options)
{
   $builder->add('country', 'entity', array(
        'class' => 'SciForumVersion2Bundle:Country',
        'property' => 'country',
    ));
}

In my Entity country, I have

/**
 * @ORM\Column(type="text")
 */
protected $country;

The object I am editing in the form is the user object:

$enquiry = $this->get('security.context')->getToken()->getUser();

In the user entity, I have

/**
 * @ORM\Column(type="integer")
 */
protected $country;

I don’t know why I am getting this error.

  • 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-12T18:36:12+00:00Added an answer on June 12, 2026 at 6:36 pm

    There seem to be a problem in your model design, the user’s “Country” property should be a Many-To-One association, not an integer (this is why the form builder complains) :

    /**
     * @ORM\ManyToOne(targetEntity="Country")
     * @ORM\JoinColumn(name="country_id", referencedColumnName="id")
     **/
    private $country;
    

    The “property” option is only used to display the entity choice to the user, Symfony2 uses the first parameter of the “add” method to decide which field of the object to edit.

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

Sidebar

Related Questions

Lets say that I have a drop down list that I want to create
I'm trying to get drop down list in Cake for below two finds by
I'm trying to create a form that based on the users input would determine
I'm trying to create a form that clients would complete via the web, so
Using C#, I'm trying to create a form with a dataGridView that shows the
I'm trying to create a custom form input that utilizes some images, it should
I am trying to create a car make/model form using Javascript or AJAX, problem
I am trying to populate a drop down list when a specific list item
I'm trying to use a list of clients that have been created from my
Possible Duplicate: CSS Drop Down Menu I am trying to create a drop down

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.