Commit fe9740f7 authored by Mat's avatar Mat

Crée 2 nouvelles entités Commande et CommandeLegumes

parent 3148a96e
<?php
namespace PotageBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Commande
*
* @ORM\Table(name="commande")
* @ORM\Entity(repositoryClass="PotageBundle\Repository\CommandeRepository")
* @ORM\HasLifecycleCallbacks()
*/
class Commande
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var int
* @ORM\ManyToOne(targetEntity="PotageBundle\Entity\Offre", inversedBy="commandes")
* @ORM\JoinColumn(name="id_offre", nullable=false)
*/
private $offre;
/**
* @var int
* @ORM\ManyToOne(targetEntity="PotageBundle\Entity\User", inversedBy="commandes")
* @ORM\JoinColumn(name="id_user", nullable=false)
*/
private $user;
/**
* @var CommandeLegumes[]
* @ORM\OneToMany(targetEntity="PotageBundle\Entity\CommandeLegumes", mappedBy="commande")
*/
private $commandeLegumes;
/**
* @var float
* @ORM\Column(name="prix_total", nullable=false)
*/
private $prixTotal;
/**
* @var \DateTime
*
* @ORM\Column(name="createdAt", type="datetime")
*/
private $createdAt;
/**
* @var \DateTime
*
* @ORM\Column(name="updatedAt", type="datetime")
*/
private $updatedAt;
/**
*
* @ORM\PrePersist()
*/
public function prePersist()
{
$this->createdAt = new \DateTime();
}
/**
*
* @ORM\PreUpdate()
*/
public function preUpdate()
{
$this->updatedAt = new \DateTime();
}
/**
* Commande constructor.
*/
public function __construct()
{
}
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
*
* @return Commande
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* @param \DateTime $updatedAt
* @return Commande
*/
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @return int
*/
public function getOffre()
{
return $this->offre;
}
/**
* @param int $offre
* @return Commande
*/
public function setOffre($offre)
{
$this->offre = $offre;
return $this;
}
/**
* @return int
*/
public function getUser()
{
return $this->user;
}
/**
* @param int $user
* @return Commande
*/
public function setUser($user)
{
$this->user = $user;
return $this;
}
/**
* @return CommandeLegumes[]
*/
public function getCommandeLegumes()
{
return $this->commandeLegumes;
}
/**
* @param CommandeLegumes[] $commandeLegumes
* @return Commande
*/
public function setCommandeLegumes($commandeLegumes)
{
$this->commandeLegumes = $commandeLegumes;
return $this;
}
/**
* @return float
*/
public function getPrixTotal()
{
return $this->prixTotal;
}
/**
* @param float $prixTotal
* @return Commande
*/
public function setPrixTotal($prixTotal)
{
$this->prixTotal = $prixTotal;
return $this;
}
}
<?php
namespace PotageBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* CommandeLegumes
*
* @ORM\Table(name="commande_legumes")
* @ORM\Entity(repositoryClass="PotageBundle\Repository\CommandeLegumesRepository")
* @ORM\HasLifecycleCallbacks()
*/
class CommandeLegumes
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var int
* @ORM\ManyToOne(targetEntity="PotageBundle\Entity\Commande", inversedBy="commandeLegumes")
* @ORM\JoinColumn(name="id_commande", nullable=false)
*/
private $commande;
/**
* @var float
*
* @ORM\Column(name="prix_unitaire", type="float")
*/
private $prixUnitaire;
/**
* @var string
*
* @ORM\Column(name="unite", type="string", length=25)
*/
private $unite;
/**
* @var float
*
* @ORM\Column(name="quantite", type="float")
*/
private $quantite;
/**
* @var float
*
* @ORM\Column(name="prix", type="float")
*/
private $prix;
/**
* @var \DateTime
*
* @ORM\Column(name="createdAt", type="datetime")
*/
private $createdAt;
/**
* @var \DateTime
*
* @ORM\Column(name="updatedAt", type="datetime")
*/
private $updatedAt;
/**
*
* @ORM\PrePersist()
*/
public function prePersist()
{
$this->createdAt = new \DateTime();
}
/**
*
* @ORM\PreUpdate()
*/
public function preUpdate()
{
$this->updatedAt = new \DateTime();
}
/**
* CommandeLegumes constructor.
*/
public function __construct()
{
}
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
*
* @return CommandeLegumes
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set updatedAt
*
* @param \DateTime $updatedAt
*
* @return CommandeLegumes
*/
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* @return int
*/
public function getCommande()
{
return $this->commande;
}
/**
* @param int $commande
* @return CommandeLegumes
*/
public function setCommande($commande)
{
$this->commande = $commande;
return $this;
}
/**
* @return float
*/
public function getPrixUnitaire()
{
return $this->prixUnitaire;
}
/**
* @param float $prixUnitaire
* @return CommandeLegumes
*/
public function setPrixUnitaire($prixUnitaire)
{
$this->prixUnitaire = $prixUnitaire;
return $this;
}
/**
* @return string
*/
public function getUnite()
{
return $this->unite;
}
/**
* @param string $unite
* @return CommandeLegumes
*/
public function setUnite($unite)
{
$this->unite = $unite;
return $this;
}
/**
* @return float
*/
public function getQuantite()
{
return $this->quantite;
}
/**
* @param float $quantite
* @return CommandeLegumes
*/
public function setQuantite($quantite)
{
$this->quantite = $quantite;
return $this;
}
/**
* @return float
*/
public function getPrix()
{
return $this->prix;
}
/**
* @param float $prix
* @return CommandeLegumes
*/
public function setPrix($prix)
{
$this->prix = $prix;
return $this;
}
}
...@@ -39,6 +39,12 @@ class Offre ...@@ -39,6 +39,12 @@ class Offre
*/ */
private $lettres; private $lettres;
/**
* @var Commande[]
* @ORM\OneToMany(targetEntity="PotageBundle\Entity\Commande", mappedBy="offre")
*/
private $commandes;
/** /**
* @var string * @var string
* *
...@@ -356,4 +362,25 @@ class Offre ...@@ -356,4 +362,25 @@ class Offre
{ {
return $this->sorted; return $this->sorted;
} }
/**
* @return Commande[]
*/
public function getCommandes()
{
return $this->commandes;
}
/**
* @param Commande[] $commandes
* @return Offre
*/
public function setCommandes($commandes)
{
$this->commandes = $commandes;
return $this;
}
} }
...@@ -48,6 +48,12 @@ class User extends BaseUser ...@@ -48,6 +48,12 @@ class User extends BaseUser
*/ */
private $utilisateur; private $utilisateur;
/**
* @var Commande[]
* @ORM\OneToMany(targetEntity="PotageBundle\Entity\Commande", mappedBy="user")
*/
private $commandes;
/** /**
* @ORM\Column(type="array", unique=false, length=255, nullable=true) * @ORM\Column(type="array", unique=false, length=255, nullable=true)
*/ */
...@@ -140,4 +146,24 @@ class User extends BaseUser ...@@ -140,4 +146,24 @@ class User extends BaseUser
} }
return $this; return $this;
} }
/**
* @return Commande[]
*/
public function getCommandes()
{
return $this->commandes;
}
/**
* @param Commande[] $commandes
* @return User
*/
public function setCommandes($commandes)
{
$this->commandes = $commandes;
return $this;
}
} }
<?php
namespace PotageBundle\Repository;
/**
* CommandeLegumesRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class CommandeLegumesRepository extends \Doctrine\ORM\EntityRepository
{
}
<?php
namespace PotageBundle\Repository;
/**
* CommandeRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class CommandeRepository 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