我试图在我的数据库中插入一个用户,并在此之前生成学说:An exception occurred while executing 'SELECT t0.id AS id_1, t0.name AS name_2, t0.first_name AS first_name_3, t0.username AS username_4, t0.password AS password_5, t0.aRoles AS aRoles_6, t0.create_date AS create_date_7, t8.id AS id_9, t8.name AS name_10, t8.siren AS siren_11, t8.social_network_list AS social_network_list_12, t8.sponso AS sponso_13, t8.created_date AS created_date_14, t8.user_id AS user_id_15 FROM user t0 LEFT JOIN company t8 ON t8.user_id = t16.id WHERE t0.username = ?' with params ["test@gmail.com"]:出现以下错误:SQLSTATE[42S22]: Column not found: 1054 Unknown column 't16.id' in 'on clause'Doctrine 创建了一个别名“t16”,但好的别名是“t0”在我的控制器中,我使用一个表单来管理用户注册。我的用户实体在这里:*** @ORM\Entity(repositoryClass=UserRepository::class)* @UniqueEntity(* fields={"username"},* message="Le compte est existant !"* )*/class User implements UserInterface{/** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */private $id;/** * @ORM\Column(type="string", length=255) */private $name;/** * @ORM\Column(type="string", length=255) */private $firstName;/** * @ORM\Column(type="string", length=255) * @Assert\Email() */private $username;/** * @ORM\Column(type="string", length=255) * @Assert\Length(min="8", minMessage="Votre mot de passe doit faire au minimum 8 caractères") */private $password;/** * @Assert\EqualTo(propertyPath="password", message="Les mots de passes ne sont pas identiques") */public $confirm_password;/** * @var array * * @ORM\Column(name="aRoles", type="array", length=400, nullable=false) */private $aroles;/** * @ORM\Column(type="datetime") */private $createDate;/** * @ORM\OneToOne(targetEntity=Company::class, mappedBy="user") */private $company;
1 回答
胡子哥哥
TA贡献1825条经验 获得超6个赞
可能与某些错误配置有关。将您的映射更改为:
用户
/**
* @ORM\OneToOne(targetEntity="Company", mappedBy="user")
*/
private $company;
公司(见用户上限)
/**
* @ORM\OneToOne(targetEntity="User", inversedBy="company")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
private $user;
- 1 回答
- 0 关注
- 79 浏览
添加回答
举报
0/150
提交
取消