Hi everyone and thanks for help,
I'm currently dealing with a problem while I want to make an OneToMany/ManyToOne Bidirectional Relationship with Doctrine2 (& Symfony2.5.6).
Here are my two classes : Voiture , and Voiture modeles
namespace Esprit\ParcBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*/
class Voiture
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string")
*/
private $serie;
/**
* @ORM\Column(type="date")
*/
private $dateM;
/**
* @ORM\Column(type="string")
*/
private $marque;
/**
* @ORM\Column(type="integer")
* @ORM\ManyToOne(targetEntity="ModeleVoiture")
* @ORM\JoinColumn(referencedColumnName="id")
*/
private $id_m;
and :
<?php
namespace Esprit\ParcBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*/
class ModeleVoiture
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
*@ORM\Column(type="string")
*/
private $libelle;
/**
* @ORM\Column(type="string")
*/
private $pays;
when i want to phpmyadmin to check if the foreign key relationis added or no, i can't find it thank you for your help.
您需要从private $id_m;
删除@ORM\\Column(type="integer")
private $id_m;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.