Commit 1b57c370 authored by Mat's avatar Mat
Browse files

ManyToMany entre Info et Lettre

parent 3a6c0590
......@@ -2,6 +2,7 @@
namespace PotageBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
......@@ -22,6 +23,12 @@ class Info
*/
private $id;
/**
* @var
* @ORM\ManyToMany(targetEntity="PotageBundle\Entity\Lettre", mappedBy="infos")
*/
private $lettres;
/**
* @var string
* @ORM\Column(name="title", type="string", length=150)
......@@ -83,6 +90,7 @@ class Info
*/
public function __construct()
{
$this->lettres = new ArrayCollection();
}
/**
......@@ -328,4 +336,38 @@ class Info
{
return $this->updatedAt;
}
/**
* Add lettre
*
* @param \PotageBundle\Entity\Lettre $lettre
*
* @return Info
*/
public function addLettre(\PotageBundle\Entity\Lettre $lettre)
{
$this->lettres[] = $lettre;
return $this;
}
/**
* Remove lettre
*
* @param \PotageBundle\Entity\Lettre $lettre
*/
public function removeLettre(\PotageBundle\Entity\Lettre $lettre)
{
$this->lettres->removeElement($lettre);
}
/**
* Get lettres
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getLettres()
{
return $this->lettres;
}
}
......@@ -2,6 +2,7 @@
namespace PotageBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
......@@ -29,6 +30,16 @@ class Lettre
*/
private $offre;
/**
* @var
* @ORM\ManyToMany(targetEntity="PotageBundle\Entity\Info", inversedBy="lettres")
* @ORM\JoinTable(name="infos_lettres",
* joinColumns={@ORM\JoinColumn(name="id_info", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="id_lettre", referencedColumnName="id")}
* )
*/
private $infos;
/**
* @var string
* @ORM\Column(name="reference", type="string", length=16, unique=true)
......@@ -78,6 +89,7 @@ class Lettre
*/
public function __construct()
{
$this->infos = new ArrayCollection();
}
/**
......@@ -299,4 +311,39 @@ class Lettre
{
return $this->offre;
}
/**
* Add info
*
* @param \PotageBundle\Entity\Info $info
*
* @return Lettre
*/
public function addInfo(\PotageBundle\Entity\Info $info)
{
$this->infos[] = $info;
return $this;
}
/**
* Remove info
*
* @param \PotageBundle\Entity\Info $info
*/
public function removeInfo(\PotageBundle\Entity\Info $info)
{
$this->infos->removeElement($info);
}
/**
* Get infos
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getInfos()
{
return $this->infos;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment