Bonjour,

J'ai réalisé une jointure entre deux tables : Ordonnances et OrdonnanceFiles. Voici la jointure en question :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
 
    /**
     * @ORM\ManyToOne(targetEntity="Ordonnances",inversedBy="files")
     * @ORM\JoinColumn(name="token", referencedColumnName="tokenid")
     */    
    protected $ordonnance;
Cependant, lorsque je fais un php app/console doctrine:schema:update --force, on me retourne un message d'erreur :

[DOCTRINE\DBAL\DBALEXCEPTION]
An exception occured whil executing 'ALTER TABLE odonnancefiles ADD CONSTRAINT FK_7669711C5F37A13B FOREIGN KEY <token> REFERENCES Ordonnances <tokenid>':
SQLSTATE[HY000]: General error: 1005 Can’t create table ‘symfony.#sql-820_1d1’ (errno: 150)
Le profiler me retourne lui l'erreur suivante :

The referenced column name 'tokenid' has to be a primary key column on the target entity class 'PharmacieLeBras\WebsiteBundle\Entity\Ordonnances'.
Enfin, lorsque je vais un doctrine:schema:validate, j'obtiens ceci :

[Mapping] FAIL - The entity-class '..........' mapping is invalid: * The referenced column name 'tokenid' has to be a primary key column on the target entity class '.........'.

Comment peut-on résoudre ce problème.
Merci