Commit 9c1f489f authored by Mat's avatar Mat

Exercice, génère 4 entités Bière, Catégorie, Brasserie, et Pays + relations

parent 1d14a5b8
<?php
namespace Api2Bundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Biere
*
* @ORM\Table(name="biere")
* @ORM\Entity(repositoryClass="Api2Bundle\Repository\BiereRepository")
*/
class Biere
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var integer
* @ORM\ManyToOne(targetEntity="Api2Bundle\Entity\Categorie", inversedBy="bieres")
* @ORM\Column(name="id_categorie")
*/
private $categorie;
/**
* @var integer
* @ORM\ManyToOne(targetEntity="Api2Bundle\Entity\Brasserie", inversedBy="bieres")
* @ORM\Column(name="id_brasserie")
*/
private $brasserie;
/**
* @var string
*
* @ORM\Column(name="nom", type="string", length=255)
*/
private $nom;
/**
* @var float
*
* @ORM\Column(name="degre", type="float")
*/
private $degre;
/**
* @var string
*
* @ORM\Column(name="image", type="string", length=255)
*/
private $image;
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set nom
*
* @param string $nom
*
* @return Biere
*/
public function setNom($nom)
{
$this->nom = $nom;
return $this;
}
/**
* Get nom
*
* @return string
*/
public function getNom()
{
return $this->nom;
}
/**
* Set degre
*
* @param float $degre
*
* @return Biere
*/
public function setDegre($degre)
{
$this->degre = $degre;
return $this;
}
/**
* Get degre
*
* @return float
*/
public function getDegre()
{
return $this->degre;
}
/**
* Set image
*
* @param string $image
*
* @return Biere
*/
public function setImage($image)
{
$this->image = $image;
return $this;
}
/**
* Get image
*
* @return string
*/
public function getImage()
{
return $this->image;
}
/**
* @return int
*/
public function getCategorie()
{
return $this->categorie;
}
/**
* @param int $categorie
* @return Biere
*/
public function setCategorie($categorie)
{
$this->categorie = $categorie;
return $this;
}
/**
* @return int
*/
public function getBrasserie()
{
return $this->brasserie;
}
/**
* @param int $brasserie
* @return Biere
*/
public function setBrasserie($brasserie)
{
$this->brasserie = $brasserie;
return $this;
}
}
<?php
namespace Api2Bundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* Brasserie
*
* @ORM\Table(name="brasserie")
* @ORM\Entity(repositoryClass="Api2Bundle\Repository\BrasserieRepository")
*/
class Brasserie
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var ArrayCollection
* @ORM\OneToMany(targetEntity="Api2Bundle\Entity\Biere", mappedBy="brasserie")
*/
private $bieres;
/**
* @var integer
* @ORM\ManyToOne(targetEntity="Api2Bundle\Entity\Pays", inversedBy="brasseries")
* @ORM\Column(name="id_pays")
*/
private $pays;
/**
* @var string
*
* @ORM\Column(name="nom", type="string", length=255)
*/
private $nom;
/**
* @var string
*
* @ORM\Column(name="adresse", type="string", length=255, nullable=true)
*/
private $adresse;
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set nom
*
* @param string $nom
*
* @return Brasserie
*/
public function setNom($nom)
{
$this->nom = $nom;
return $this;
}
/**
* Get nom
*
* @return string
*/
public function getNom()
{
return $this->nom;
}
/**
* Set adresse
*
* @param string $adresse
*
* @return Brasserie
*/
public function setAdresse($adresse)
{
$this->adresse = $adresse;
return $this;
}
/**
* Get adresse
*
* @return string
*/
public function getAdresse()
{
return $this->adresse;
}
/**
* @return ArrayCollection
*/
public function getBieres()
{
return $this->bieres;
}
/**
* @param ArrayCollection $bieres
* @return Brasserie
*/
public function setBieres($bieres)
{
$this->bieres = $bieres;
return $this;
}
/**
* @return int
*/
public function getPays()
{
return $this->pays;
}
/**
* @param int $pays
* @return Brasserie
*/
public function setPays($pays)
{
$this->pays = $pays;
return $this;
}
}
<?php
namespace Api2Bundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* Categorie
*
* @ORM\Table(name="categorie")
* @ORM\Entity(repositoryClass="Api2Bundle\Repository\CategorieRepository")
*/
class Categorie
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var ArrayCollection
* @ORM\OneToMany(targetEntity="Api2Bundle\Entity\Biere", mappedBy="categorie")
*/
private $bieres;
/**
* @var string
*
* @ORM\Column(name="nom", type="string", length=255)
*/
private $nom;
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set nom
*
* @param string $nom
*
* @return Categorie
*/
public function setNom($nom)
{
$this->nom = $nom;
return $this;
}
/**
* Get nom
*
* @return string
*/
public function getNom()
{
return $this->nom;
}
/**
* @return ArrayCollection
*/
public function getBieres()
{
return $this->bieres;
}
/**
* @param ArrayCollection $bieres
*/
public function setBieres($bieres)
{
$this->bieres = $bieres;
}
}
<?php
namespace Api2Bundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* Pays
*
* @ORM\Table(name="pays")
* @ORM\Entity(repositoryClass="Api2Bundle\Repository\PaysRepository")
*/
class Pays
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var ArrayCollection
* @ORM\OneToMany(targetEntity="Api2Bundle\Entity\Brasserie", mappedBy="pays")
*/
private $brasseries;
/**
* @var string
*
* @ORM\Column(name="isocode", type="string", length=255, unique=true)
*/
private $isocode;
/**
* @var string
*
* @ORM\Column(name="nom", type="string", length=255)
*/
private $nom;
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set isocode
*
* @param string $isocode
*
* @return Pays
*/
public function setIsocode($isocode)
{
$this->isocode = $isocode;
return $this;
}
/**
* Get isocode
*
* @return string
*/
public function getIsocode()
{
return $this->isocode;
}
/**
* Set nom
*
* @param string $nom
*
* @return Pays
*/
public function setNom($nom)
{
$this->nom = $nom;
return $this;
}
/**
* Get nom
*
* @return string
*/
public function getNom()
{
return $this->nom;
}
/**
* @return ArrayCollection
*/
public function getBrasseries()
{
return $this->brasseries;
}
/**
* @param ArrayCollection $brasseries
*/
public function setBrasseries($brasseries)
{
$this->brasseries = $brasseries;
}
}
<?php
namespace Api2Bundle\Repository;
/**
* BiereRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class BiereRepository extends \Doctrine\ORM\EntityRepository
{
}
<?php
namespace Api2Bundle\Repository;
/**
* BrasserieRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class BrasserieRepository extends \Doctrine\ORM\EntityRepository
{
}
<?php
namespace Api2Bundle\Repository;
/**
* CategorieRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class CategorieRepository extends \Doctrine\ORM\EntityRepository
{
}
<?php
namespace Api2Bundle\Repository;
/**
* PaysRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class PaysRepository extends \Doctrine\ORM\EntityRepository
{
}
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