I created database on my local machine. After moving my project to server I imported backup from local (because I had some important data there).
Now,when I\'m trying t
For me it worked with the following setup (with two relations). The trick was to not mix up mappedBy
and inversedBy
.
/**
* @ORM\Entity
* @ORM\Table(name="user")
*/
class User extends BaseUser
{
/**
* @var Merchant
*
* @ORM\OneToOne(targetEntity="Merchant", mappedBy="user")
*/
protected $merchant;
/**
* @var Client
*
* @ORM\OneToOne(targetEntity="Client", mappedBy="user")
*/
protected $client;
}
/**
* @ORM\Table(name="merchant")
* @ORM\Entity
*/
class Merchant extends BaseEntity
{
/**
* @ORM\OneToOne(targetEntity="User", inversedBy="merchant")
*/
protected $user;
}
/**
* @ORM\Table(name="client")
* @ORM\Entity
*/
class Client extends BaseEntity
{
/**
* @ORM\OneToOne(targetEntity="User", inversedBy="client")
*/
protected $user;
}