Note that there are some explanatory texts on larger screens.

plurals
  1. PODoctrine generation of OneToMany relations
    text
    copied!<p>EDIT</p> <p>Let's take the following model :</p> <p><img src="https://i.stack.imgur.com/6jQkm.png" alt="enter image description here"></p> <p>The following entities are generated with the command doctrine:mapping:import :</p> <pre><code>class Toto { /** * @var integer $idtoto * * @ORM\Column(name="idtoto", type="integer", nullable=false) * @ORM\Id * @ORM\GeneratedValue(strategy="IDENTITY") */ private $idtoto; /** * Get idtoto * * @return integer */ public function getIdtoto() { return $this-&gt;idtoto; } } class Tata { /** * @var integer $idtata * * @ORM\Column(name="idtata", type="integer", nullable=false) * @ORM\Id * @ORM\GeneratedValue(strategy="IDENTITY") */ private $idtata; /** * @var Toto * * @ORM\ManyToOne(targetEntity="Toto") * @ORM\JoinColumns({ * @ORM\JoinColumn(name="idtoto", referencedColumnName="idtoto") * }) */ private $idtoto; /** * Get idtata * * @return integer */ public function getIdtata() { return $this-&gt;idtata; } /** * Set idtoto * * @param Creatis\SaisieBundle\Entity\Toto $idtoto */ public function setIdtoto(\Creatis\SaisieBundle\Entity\Toto $idtoto) { $this-&gt;idtoto = $idtoto; } /** * Get idtoto * * @return Creatis\SaisieBundle\Entity\Toto */ public function getIdtoto() { return $this-&gt;idtoto; } } </code></pre> <p>Why is the relation OneToMany in class Toto NOT generated (had to type it by hand) :</p> <pre><code>/** * @ORM\OneToMany(targetEntity="Tata", mappedBy="idToto") */ private $tatas; </code></pre> <p>Is there an option to put in the command line ?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload