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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:34:36+00:00 2026-06-03T06:34:36+00:00

I am getting the following error, when I want to add new UserProfile using

  • 0

I am getting the following error, when I want to add new UserProfile using autogenerated form.The error is:
Expected an object, but got a collection. Did you forget to pass “multiple=true” to an entity field?

I am using Symfony 2.0.12

This is my code for the UserProfile entity. The issue occurred in Controller, but I am not sure how to solve it. Please help.

<?php

namespace Infidia\OutsourceBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;

/**
 * Infidia\OutsourceBundle\Entity\UserProfile
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Infidia\OutsourceBundle\Entity\UserProfileRepository")
 */
class UserProfile
{
/**
 * @var integer $id
 *
 * @ORM\Column(name="id", type="integer")
 * @ORM\Id
 * @ORM\GeneratedValue(strategy="AUTO")
 */
private $id;

/**
 *
 * @ORM\OneToOne(targetEntity="User")
 * @orm:JoinColumn(name="userid", referencedColumnName="id")
 */
private $user;

/**
 * @var  integer $userid
 */
private $userid;

/**
 * @var text $street_address
 *
 * @ORM\Column(name="street_address", type="text")
 */
private $street_address;

/**
 * @var string $city
 *
 * @ORM\Column(name="city", type="string", length=255)
 */
private $city;

/**
 * @var string $country
 *
 * @ORM\Column(name="country", type="string", length=255)
 */
private $country;

/**
 * @var string $zipcode
 *
 * @ORM\Column(name="zipcode", type="string", length=255)
 */
private $zipcode;

/**
 * @var string $timezone
 *
 * @ORM\Column(name="timezone", type="string", length=12)
 */
private $timezone;

/**
 * @var string $contact_no
 *
 * @ORM\Column(name="contact_no", type="string", length=20)
 */
private $contact_no;

/**
 * @var date $birthday
 *
 * @ORM\Column(name="birthday", type="date")
 */
private $birthday;

/**
 * @var string $gender
 *
 * @ORM\Column(name="gender", type="string", length=15)
 */
private $gender;


/**
 * Get id
 *
 * @return integer 
 */
public function getId()
{
    return $this->id;
}


/**
 * Set street_address
 *
 * @param text $streetAddress
 */
public function setStreetAddress($streetAddress)
{
    $this->street_address = $streetAddress;
}

/**
 * Get street_address
 *
 * @return text 
 */
public function getStreetAddress()
{
    return $this->street_address;
}

/**
 * Set city
 *
 * @param string $city
 */
public function setCity($city)
{
    $this->city = $city;
}

/**
 * Get city
 *
 * @return string 
 */
public function getCity()
{
    return $this->city;
}

/**
 * Set country
 *
 * @param string $country
 */
public function setCountry($country)
{
    $this->country = $country;
}

/**
 * Get country
 *
 * @return string 
 */
public function getCountry()
{
    return $this->country;
}

/**
 * Set zipcode
 *
 * @param string $zipcode
 */
public function setZipcode($zipcode)
{
    $this->zipcode = $zipcode;
}

/**
 * Get zipcode
 *
 * @return string 
 */
public function getZipcode()
{
    return $this->zipcode;
}

/**
 * Set timezone
 *
 * @param string $timezone
 */
public function setTimezone($timezone)
{
    $this->timezone = $timezone;
}

/**
 * Get timezone
 *
 * @return string 
 */
public function getTimezone()
{
    return $this->timezone;
}

/**
 * Set contact_no
 *
 * @param string $contactNo
 */
public function setContactNo($contactNo)
{
    $this->contact_no = $contactNo;
}

/**
 * Get contact_no
 *
 * @return string 
 */
public function getContactNo()
{
    return $this->contact_no;
}

/**
 * Set birthday
 *
 * @param date $birthday
 */
public function setBirthday($birthday)
{
    $this->birthday = $birthday;
}

/**
 * Get birthday
 *
 * @return date 
 */
public function getBirthday()
{
    return $this->birthday;
}

/**
 * Set gender
 *
 * @param string $gender
 */
public function setGender($gender)
{
    $this->gender = $gender;
}

/**
 * Get gender
 *
 * @return string 
 */
public function getGender()
{
    return $this->gender;
}

/**
 * Set experience
 *
 * @param \Infidia\OutsourceBundle\Entity\text $experience
 */
public function setExperience($experience)
{
    $this->experience = $experience;
}

/**
 * Get Experience
 *
 * @return \Infidia\OutsourceBundle\Entity\text
 */
public function getExperience()
{
    return $this->experience;
}

/**
 * Set UserId
 *
 * @param int $userid
 */
public function setUserid($userid)
{
    $this->userid = $userid;
}

/**
 * Get UserId
 * @return int
 */
public function getUserid()
{
    return $this->userid;
}

public function __construct()
{
    $this->user = new ArrayCollection();
}

/**
 * Set user
 *
 * @param Infidia\OutsourceBundle\Entity\User $user
 */
public function setUser(\Infidia\OutsourceBundle\Entity\User $user)
{
    $this->user = $user;
}

/**
 * Get user
 *
 * @return Infidia\OutsourceBundle\Entity\User 
 */
public function getUser()
{
    return $this->user;
}
}
  • 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-03T06:34:38+00:00Added an answer on June 3, 2026 at 6:34 am

    The problem is in your form…
    Try this.

     public function buildForm(FormBuilder $builder, array $options) {
    
    
            $builder
    ->add('employeeType', 'entity', array(
                        'class' => 'MyProject\EntityBundle\Entity\Employee',
                        'property' => 'name',
                          'multiple'=>'true','query_builder' => function ($repository) { return $repository->createQueryBuilder('es')->orderBy('es.name', 'ASC'); },
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting following error when I am trying to get WebResponse using WebResponse
I am getting following error message when using Doctrine ORM in Codeigniter. ( !
New to android programming. Getting Following error. 04-07 14:49:05.452: ERROR/AndroidRuntime(1566): FATAL EXCEPTION: main java.lang.OutOfMemoryError
i am new to Django. I want to add country field to my form.
I'm getting an error when using Entity Framework - Code First in the following
Am getting following error message on calling WCF service: The formatter threw an exception
I am getting following error in different places like when I am removing an
I am getting following error: error: calling a host function(strcpy) from a __device__/__global__ function(doDecompression)
We are getting following error when we try to validate our app. This bundle
SOLVED in the last answer im getting following error, dunno where and why? cause

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.