Maybe this wil help: 
http://stackoverflow.com/questions/10372078/error-when-targetentity-is-in-a-different-bundle
The remark about app/config.yml 

Further (a bit more difficult) I found several postings suggesting that 
another entity in anothere bundle would use another entitymanager, in which 
case you would get a solution like this: 
http://symfony.com/doc/current/cookbook/doctrine/multiple_entity_managers.html
I don't know the solution for your problem, but just looking with you. I'm 
interested in it myself too. Hope it helps and is not more confusing.

The fieldname $idadresse is wrong, but not causing the error. You don't 
reference an id here, but another entity. But that is a next step after the 
problem is solved.

On Tuesday, 22 April 2014 15:32:58 UTC+2, Chargui Taieb wrote:
>
> User.php under src/Application/Sonata/UserBundle/Entity/User
>>
> <?php
>
> namespace Application\Sonata\UserBundle\Entity;
> use FOS\UserBundle\Model\GroupableInterface;
> use Sonata\UserBundle\Entity\BaseUser as BaseUser;
>
> use Doctrine\ORM\Mapping as ORM;
>
> /**
>  * This file has been generated by the Sonata EasyExtends bundle ( 
> http://sonata-project.org/easy-extends )
>  *
>  * References :
>  *   working with object : 
> http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
>  *
>  * @ORM\Entity
>  * @ORM\Table(name="user")
>  */
> class User extends BaseUser
> {
>
>     /**
>      * @var integer $id
>      *
>      * @ORM\Id
>      * @ORM\Column(type="integer")
>      * @ORM\GeneratedValue(strategy="AUTO")
>      */
>     protected $id;
>     /**
>      * @var string
>      *
>      * @ORM\Column(name="imageuser", type="text", nullable=true)
>      */
>     private $imageuser;
>     /**
>      * Get id
>      *
>      * @return integer $id
>      */
>     public function getId()
>     {
>         return $this->id;
>     }
>     /**
>      * @var \DateTime
>      */
>     protected $dateOfBirth;
>
>     /**
>      * @var string
>      */
>     protected $firstname;
>
>     /**
>      * @var string
>      */
>     protected $lastname;
>
>     /**
>      * @var string
>      */
>     protected $website;
>
>     /**
>      * @var string
>      */
>     protected $gender;
>
>     /**
>      * @var string
>      */
>     protected $phone;
>     
>     /**
>      * @ManyToOne(targetEntity="Acme\AdresseBundle\Entity\Adresse")
>     */
>     private $idadresse;
>
>
>     /**
>      * @var \Doctrine\Common\Collections\Collection
>      */
>     protected $groups;
>
>     /**
>      * Constructor
>      */
>     public function __construct()
>     {
>         $this->groups = new \Doctrine\Common\Collections\ArrayCollection();
>         parent::__construct();
>     }
>
>     /**
>      * Set imageuser
>      *
>      * @param string $imageuser
>      * @return User
>      */
>     public function setImageuser($imageuser)
>     {
>         $this->imageuser = $imageuser;
>
>         return $this;
>     }
>
>     /**
>      * Get imageuser
>      *
>      * @return string 
>      */
>     public function getImageuser()
>     {
>         return $this->imageuser;
>     }
>
>     /**
>      * Set dateOfBirth
>      *
>      * @param \DateTime $dateOfBirth
>      * @return User
>      */
>     public function setDateOfBirth($dateOfBirth)
>     {
>         $this->dateOfBirth = $dateOfBirth;
>
>         return $this;
>     }
>
>     /**
>      * Get dateOfBirth
>      *
>      * @return \DateTime 
>      */
>     public function getDateOfBirth()
>     {
>         return $this->dateOfBirth;
>     }
>
>     /**
>      * Set firstname
>      *
>      * @param string $firstname
>      * @return User
>      */
>     public function setFirstname($firstname)
>     {
>         $this->firstname = $firstname;
>
>         return $this;
>     }
>
>     /**
>      * Get firstname
>      *
>      * @return string 
>      */
>     public function getFirstname()
>     {
>         return $this->firstname;
>     }
>
>     /**
>      * Set lastname
>      *
>      * @param string $lastname
>      * @return User
>      */
>     public function setLastname($lastname)
>     {
>         $this->lastname = $lastname;
>
>         return $this;
>     }
>
>     /**
>      * Get lastname
>      *
>      * @return string 
>      */
>     public function getLastname()
>     {
>         return $this->lastname;
>     }
>
>     /**
>      * Set website
>      *
>      * @param string $website
>      * @return User
>      */
>     public function setWebsite($website)
>     {
>         $this->website = $website;
>
>         return $this;
>     }
>
>     /**
>      * Get website
>      *
>      * @return string 
>      */
>     public function getWebsite()
>     {
>         return $this->website;
>     }
>
>     /**
>      * Set gender
>      *
>      * @param string $gender
>      * @return User
>      */
>     public function setGender($gender)
>     {
>         $this->gender = $gender;
>
>         return $this;
>     }
>
>     /**
>      * Get gender
>      *
>      * @return string 
>      */
>     public function getGender()
>     {
>         return $this->gender;
>     }
>
>     /**
>      * Set phone
>      *
>      * @param string $phone
>      * @return User
>      */
>     public function setPhone($phone)
>     {
>         $this->phone = $phone;
>
>         return $this;
>     }
>
>     /**
>      * Get phone
>      *
>      * @return string 
>      */
>     public function getPhone()
>     {
>         return $this->phone;
>     }
>
>     /**
>      * Add groups
>      *
>      * @param \Application\Sonata\UserBundle\Entity\Group $groups
>      * @return User
>      */
>     public function addGroup(\FOS\UserBundle\Model\GroupInterface $groups)
>     {
>         $this->groups[] = $groups;
>
>         return $this;
>     }
>
>     /**
>      * Remove groups
>      *
>      * @param \Application\Sonata\UserBundle\Entity\Group $groups
>      */
>     public function removeGroup(\FOS\UserBundle\Model\GroupInterface 
> $groups)
>     {
>         $this->groups->removeElement($groups);
>     }
>
>     /**
>      * Get groups
>      *
>      * @return \Doctrine\Common\Collections\Collection 
>      */
>     public function getGroups()
>     {
>         return $this->groups;
>     }
>   
>
>
>     
> }
>
>
>
> & here the AdresseEntity under src/Acme/AdresseBundle/Entity/Adresse
>
> <?php
>
> namespace Acme\AdresseBundle\Entity;
>
> use Doctrine\ORM\Mapping as ORM;
>
> /**
>  * Adresse
>  */
> class Adresse
> {
>     /**
>      * @var string
>      */
>     private $typeadresse;
>
>     /**
>      * @var string
>      */
>     private $descripComplm;
>
>     /**
>      * @var integer
>      */
>     private $idadresse;
>
>
>     /**
>      * Set typeadresse
>      *
>      * @param string $typeadresse
>      * @return Adresse
>      */
>     public function setTypeadresse($typeadresse)
>     {
>         $this->typeadresse = $typeadresse;
>
>         return $this;
>     }
>
>     /**
>      * Get typeadresse
>      *
>      * @return string 
>      */
>     public function getTypeadresse()
>     {
>         return $this->typeadresse;
>     }
>
>     /**
>      * Set descripComplm
>      *
>      * @param string $descripComplm
>      * @return Adresse
>      */
>     public function setDescripComplm($descripComplm)
>     {
>         $this->descripComplm = $descripComplm;
>
>         return $this;
>     }
>
>     /**
>      * Get descripComplm
>      *
>      * @return string 
>      */
>     public function getDescripComplm()
>     {
>         return $this->descripComplm;
>     }
>
>     /**
>      * Get idadresse
>      *
>      * @return integer 
>      */
>     public function getIdadresse()
>     {
>         return $this->idadresse;
>     }
> }
>
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to