relation ManyToOne impossible à générer
Bonjour,
J'ai deux entité que j'aimerai reliées ensemble par le biais d'une relation ManyToOne cependant impossible de la générer. J'ai une entity utilisateur qui extend de l'entité User de fosuserBundle contenant donc des champs d'ou le champs cv que j'aimerai relié à une entité curriculumVitae. Je pense qu'elle ne se génére pas à cause du fichier .orm.yml que je n'arrive pas à adapté ( en tout cas se ne fonctionne pas). L'entité CurriculumVite Se trouve dans un Bundle dont une fichier orm.yml est généré. L'entity Utilisateurs est dans un autre bundle dans fichier orm.yml car c'est un formulaire extend de fosUserBundle.
l'entité curriculumVite
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
<?php
namespace ...\Entity;
use ...\Entity\Utilisateurs;
use Doctrine\ORM\Mapping as ORM;
/**
* CurriculumVitae
*/
class CurriculumVitae
{
/**
* @var int
*/
private $id;
/**
* @ORM\OneToMany(targetEntity="...\Entity\CurriculumVitae", mappedBy="utilisateurCurriculumVitae")
*/
private $utilisateurCurriculumVitae;
/**
* @var string
*/
private $document;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set utilisateurCurriculumVitae
*
* @param string $utilisateurCurriculumVitae
*
* @return CurriculumVitae
*/
public function setUtilisateurCurriculumVitae($utilisateurCurriculumVitae)
{
$this->utilisateurCurriculumVitae = $utilisateurCurriculumVitae;
return $this;
}
/**
* Get utilisateurCurriculumVitae
*
* @return string
*/
public function getUtilisateurCurriculumVitae()
{
return $this->utilisateurCurriculumVitae;
}
/**
* Set document
*
* @param string $document
*
* @return CurriculumVitae
*/
public function setDocument($document)
{
$this->document = $document;
return $this;
}
/**
* Get document
*
* @return string
*/
public function getDocument()
{
return $this->document;
}
} |
l'entité utilisateurs
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
|
<?php
namespace ...\Entity;
use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
use ...\Entity\CurriculumVitae;
/**
* @ORM\Entity
* @ORM\Table(name="utilisateurs")
*/
class Utilisateurs extends BaseUser
{
public function __construct()
{
$this-> $curriculumVitae = new ArrayCollection();
}
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string")
*/
private $firstName;
/**
* @ORM\Column(type="string")
*/
private $adress;
/**
* @ORM\Column(type="string")
*/
private $postal;
/**
* @ORM\Column(type="string")
*/
private $city;
/**
* @ORM\Column(type="string")
*/
private $phone;
/**
* @ORM\Column(type="string")
*/
private $job;
/**
* @ORM\Column(type="string")
*/
private $curriculumVitae;
/**
* Set firstName
*
* @param string $firstName
*
* @return Utilisateurs
*/
public function setFirstName($firstName)
{
$this->firstName = $firstName;
return $this;
}
/**
* Get firstName
*
* @return string
*/
public function getFirstName()
{
return $this->firstName;
}
/**
* Set adress
*
* @param string $adress
*
* @return Utilisateurs
*/
public function setAdress($adress)
{
$this->adress = $adress;
return $this;
}
/**
* Get adress
*
* @return string
*/
public function getAdress()
{
return $this->adress;
}
/**
* Set postal
*
* @param string $postal
*
* @return Utilisateurs
*/
public function setPostal($postal)
{
$this->postal = $postal;
return $this;
}
/**
* Get postal
*
* @return string
*/
public function getPostal()
{
return $this->postal;
}
/**
* Set city
*
* @param string $city
*
* @return Utilisateurs
*/
public function setCity($city)
{
$this->city = $city;
return $this;
}
/**
* Get city
*
* @return string
*/
public function getCity()
{
return $this->city;
}
/**
* Set phone
*
* @param string $phone
*
* @return Utilisateurs
*/
public function setPhone($phone)
{
$this->phone = $phone;
return $this;
}
/**
* Get phone
*
* @return string
*/
public function getPhone()
{
return $this->phone;
}
/**
* Set job
*
* @param string $job
*
* @return Utilisateurs
*/
public function setJob($job)
{
$this->job = $job;
return $this;
}
/**
* Get job
*
* @return string
*/
public function getJob()
{
return $this->job;
}
/**
* Set curriculumVitae
*
* @param string $curriculumVitae
*
* @return Utilisateurs
*/
public function setCurriculumVitae($curriculumVitae)
{
$this->curriculumVitae = $curriculumVitae;
return $this;
}
/**
* Get curriculumVitae
*
* @return string
*/
public function getCurriculumVitae()
{
return $this->curriculumVitae;
}
} |
fichier orm.yml de curriculumVite
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
...\Entity\CurriculumVitae:
type: entity
table: null
repositoryClass: ....\Repository\CurriculumVitaeRepository
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
utilisateurCurriculumVitae:
type: string
length: 255
document:
type: string
length: 255
nullable: true
lifecycleCallbacks: { } |
Merci d'avance