i'm trying create database doctrine 2 php entity.
here code class team :
<?php // team.php /** * @entity @table(name="team") **/ class team { /** * @id * @onetoone(targetentity="user") * @joincolumn(name="userid", referencedcolumnname="id") */ protected $user; /** * @column(type="string",length=30) * @var string **/ protected $function; /** * @column(type="text") * @var string **/ protected $description; /** * @onetoone(targetentity="file") * @joincolumn(name="fileid", referencedcolumnname="id") */ protected $img; /** * @onetoone(targetentity="file") * @joincolumn(name="fileid", referencedcolumnname="id") */ protected $cv; /** * @id * @onetoone(targetentity="language") * @joincolumn(name="languageid", referencedcolumnname="id") */ protected $lang; public function getuser() { return $this->user; } public function setuser(user $user) { $this->user = $user; } public function getfunction() { return $this->function; } public function setfunction($function) { $this->function = $function; } public function getdescription() { return $this->description; } public function setdescription($description) { $this->description = $description; } public function getimg() { return $this->img; } public function setimg($img) { $this->img = $img; } public function getcv() { return $this->cv; } public function setcv($cv) { $this->cv = $cv; } public function getlang() { return $this->lang; } public function setlang(language $language) { $this->lang = $language; } } and error :
[doctrine\dbal\schema\schemaexception] index name 'uniq_c4e0a61f93cb796c' defined on table 'team' doctrine loaded composer , used windows cmd (if can help).
i've seen issue has been reported v.2.5.0 loaded 2.4.7 same error, tried dev-master still same.
i tried removing composite id , replaced simple generated @id, or none (doctrine saying no identifier/primary key specified entity "team").
this code working v.2.4.2 point update tools used project.
do know how ?
well well, found problem :
/** * @onetoone(targetentity="file") * @joincolumn(name="fileid", referencedcolumnname="id") */ protected $img; /** * @onetoone(targetentity="file") * @joincolumn(name="fileid", referencedcolumnname="id") */ protected $cv; more precisely @joincolumn(name="fileid", referencedcolumnname="id"), column name fileid same both.
thanks anyway !
Comments
Post a Comment