Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace AppBundleEntity;
- use DoctrineORMMapping as ORM;
- use JMSSerializerAnnotation as JMS;
- /**
- * LigneCommande
- *
- * @ORMTable(name="ligne_commande")
- * @ORMEntity(repositoryClass="AppBundleRepositoryLigneCommandeRepository")
- */
- class LigneCommande
- {
- /**
- * @var int
- *
- * @JMSGroups({"listeLigneCommandes", "detailLigneCommande"})
- *
- * @ORMColumn(name="id", type="integer")
- * @ORMId
- * @ORMGeneratedValue(strategy="AUTO")
- */
- protected $id;
- /**
- * @var Commande
- *
- * @JMSGroups({"listeLigneCommandes", "detailLigneCommande"})
- *
- * Many LigneCommande have One numeroCommande.
- * @ORMManyToOne(targetEntity="Commande", inversedBy="lignes", cascade={"all"}, fetch="EAGER")
- */
- protected $commande;
- /**
- * @var Article
- *
- * @JMSGroups({"listeLigneCommandes", "detailLigneCommande"})
- *
- * Many LigneCommande have One codeArticle.
- * @ORMManyToOne(targetEntity="Article", inversedBy="lignes", cascade={"all"}, fetch="EAGER")
- */
- protected $article;
- /**
- * @var string
- *
- * @JMSGroups({"listeLigneCommandes", "detailLigneCommande"})
- *
- * @ORMColumn(name="libelle", type="string", length=255)
- */
- protected $libelle;
- /**
- * @var string
- *
- * @JMSGroups({"listeLigneCommandes", "detailLigneCommande"})
- *
- * @ORMColumn(name="unite", type="string", length=255)
- */
- protected $unite;
- /**
- * @var float
- *
- * @JMSGroups({"listeLigneCommandes", "detailLigneCommande"})
- *
- * @ORMColumn(name="qte_commande", type="float")
- */
- protected $qteCommande;
- /**
- * @var float
- *
- * @JMSGroups({"listeLigneCommandes", "detailLigneCommande"})
- *
- * @ORMColumn(name="qte_recue", type="float")
- */
- protected $qteRecue;
- /**
- * @var float
- *
- * @JMSGroups({"listeLigneCommandes", "detailLigneCommande"})
- *
- * @ORMColumn(name="qte_arecevoir", type="float")
- */
- protected $qteArecevoir;
- /**
- * @var float
- *
- * @JMSGroups({"listeLigneCommandes", "detailLigneCommande"})
- *
- * @ORMColumn(name="identifiant", type="float", unique=true)
- */
- protected $identifiant;
- /**
- * Get id
- *
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set commande
- *
- * @param Commande $commande
- *
- * @return LigneCommande
- */
- public function setCommande(Commande $commande)
- {
- $this->numero = $commande;
- return $this;
- }
- /**
- * Get commande
- *
- * @return Commande
- */
- public function getCommande()
- {
- return $this->commande;
- }
- /**
- * Set article
- *
- * @param Article $article
- *
- * @return LigneCommande
- */
- public function setArticle(Article $article)
- {
- $this->article = $article;
- return $this;
- }
- /**
- * Get article
- *
- * @return Article
- */
- public function getArticle()
- {
- return $this->article;
- }
- /**
- * Set libelle
- *
- * @param string $libelle
- *
- * @return LigneCommande
- */
- public function setLibelle($libelle)
- {
- $this->libelle = $libelle;
- return $this;
- }
- /**
- * Get libelle
- *
- * @return string
- */
- public function getLibelle()
- {
- return $this->libelle;
- }
- /**
- * Set unite
- *
- * @param string $unite
- *
- * @return LigneCommande
- */
- public function setUnite($unite)
- {
- $this->unite = $unite;
- return $this;
- }
- /**
- * Get unite
- *
- * @return string
- */
- public function getUnite()
- {
- return $this->unite;
- }
- /**
- * Set qteCommande
- *
- * @param float $qteCommande
- *
- * @return LigneCommande
- */
- public function setQteCommande($qteCommande)
- {
- $this->qteCommande = $qteCommande;
- return $this;
- }
- /**
- * Get qteCommande
- *
- * @return float
- */
- public function getQteCommande()
- {
- return $this->qteCommande;
- }
- /**
- * Set qteRecue
- *
- * @param float $qteRecue
- *
- * @return LigneCommande
- */
- public function setQteRecue($qteRecue)
- {
- $this->qteRecue = $qteRecue;
- return $this;
- }
- /**
- * Get qteRecue
- *
- * @return float
- */
- public function getQteRecue()
- {
- return $this->qteRecue;
- }
- /**
- * Set qteArecevoir
- *
- * @param float $qteArecevoir
- *
- * @return LigneCommande
- */
- public function setQteArecevoir($qteArecevoir)
- {
- $this->qteArecevoir = $qteArecevoir;
- return $this;
- }
- /**
- * Get qteArecevoir
- *
- * @return float
- */
- public function getQteArecevoir()
- {
- return $this->qteArecevoir;
- }
- /**
- * Set identifiant
- *
- * @param float $identifiant
- *
- * @return LigneCommande
- */
- public function setIdentifiant($identifiant)
- {
- $this->identifiant = $identifiant;
- return $this;
- }
- /**
- * Get identifiant
- *
- * @return float
- */
- public function getIdentifiant()
- {
- return $this->identifiant;
- }
- }
- <?php
- namespace AppBundleEntity;
- use DoctrineCommonCollectionsArrayCollection;
- use DoctrineCommonCollectionsCollection;
- use DoctrineORMMapping as ORM;
- use JMSSerializerAnnotation as JMS;
- /**
- * Commande
- *
- * @ORMTable(name="commande")
- * @ORMEntity(repositoryClass="AppBundleRepositoryCommandeRepository")
- */
- class Commande
- {
- /**
- * @var int
- *
- * @JMSGroups({"listeCommandes"})
- *
- * @ORMColumn(name="id", type="integer")
- * @ORMId
- * @ORMGeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var string
- *
- * @JMSGroups({"listeCommandes", "detailCommande"})
- *
- * @ORMColumn(name="numero", type="string", length=8, unique=true)
- */
- private $numero;
- /**
- * @var DateTime
- *
- * @JMSGroups({"listeCommandes", "detailCommande"})
- *
- * @ORMColumn(name="date", type="date")
- */
- private $date;
- /**
- * @var int
- *
- * @JMSGroups({"listeCommandes", "detailCommande"})
- *
- * @ORMColumn(name="chantier_id", type="integer")
- *
- * Many Commande have One chantierCode.
- * @ORMManyToOne(targetEntity="Chantier")
- * @ORMJoinColumn(name="chantier_id", referencedColumnName="id")
- */
- private $chantier;
- /**
- * @var string
- *
- * @JMSGroups({"listeCommandes", "detailCommande"})
- *
- * @ORMColumn(name="fournisseur_code", type="string", length=7)
- */
- private $fournisseurCode;
- /**
- * @var string
- *
- * @JMSGroups({"listeCommandes", "detailCommande"})
- *
- * @ORMColumn(name="fournisseur_nom", type="string", length=255)
- */
- private $fournisseurNom;
- /**
- * @var string
- *
- * @JMSGroups({"listeCommandes", "detailCommande"})
- *
- * @ORMColumn(name="redacteur_code", type="string", length=5)
- */
- private $redacteurCode;
- /**
- * @var string
- *
- * @JMSGroups({"listeCommandes", "detailCommande"})
- *
- * @ORMColumn(name="secteur_code", type="string", length=1, nullable=true)
- */
- private $secteurCode;
- /**
- * @var string
- *
- * @JMSGroups({"listeCommandes", "detailCommande"})
- *
- * @ORMColumn(name="livraison_nom", type="string", length=255)
- */
- private $livraisonNom;
- /**
- * @var string
- *
- * @JMSGroups({"listeCommandes", "detailCommande"})
- *
- * @ORMColumn(name="livraison_adresse", type="string", length=255)
- */
- private $livraisonAdresse;
- /**
- * @var string
- *
- * @JMSGroups({"listeCommandes", "detailCommande"})
- *
- * @ORMColumn(name="livraison_cp", type="string", length=5)
- */
- private $livraisonCp;
- /**
- * @var string
- *
- * @JMSGroups({"listeCommandes", "detailCommande"})
- *
- * @ORMColumn(name="livraison_ville", type="string", length=255)
- */
- private $livraisonVille;
- /**
- * @var Collection
- *
- * @ORMOneToMany(targetEntity="LigneCommande", mappedBy="commande")
- */
- protected $lignes;
- public function __construct() {
- $this->lignes = new ArrayCollection();
- }
- /**
- * Get id
- *
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set numero
- *
- * @param string $numero
- *
- * @return Commande
- */
- public function setNumero($numero)
- {
- $this->numero = $numero;
- return $this;
- }
- /**
- * Get numero
- *
- * @return string
- */
- public function getNumero()
- {
- return $this->numero;
- }
- /**
- * Set date
- *
- * @param DateTime $date
- *
- * @return Commande
- */
- public function setDate($date)
- {
- $this->date = $date;
- return $this;
- }
- /**
- * Get date
- *
- * @return DateTime
- */
- public function getDate()
- {
- return $this->date;
- }
- /**
- * Set chantier
- *
- * @param int $chantier
- *
- * @return Commande
- */
- public function setChantier($chantier)
- {
- $this->chantier = $chantier;
- return $this;
- }
- /**
- * Get chantier
- *
- * @return int
- */
- public function getChantier()
- {
- return $this->chantier;
- }
- /**
- * Set fournisseurCode
- *
- * @param string $fournisseurCode
- *
- * @return Commande
- */
- public function setFournisseurCode($fournisseurCode)
- {
- $this->fournisseurCode = $fournisseurCode;
- return $this;
- }
- /**
- * Get fournisseurCode
- *
- * @return string
- */
- public function getFournisseurCode()
- {
- return $this->fournisseurCode;
- }
- /**
- * Set fournisseurNom
- *
- * @param string $fournisseurNom
- *
- * @return Commande
- */
- public function setFournisseurNom($fournisseurNom)
- {
- $this->fournisseurNom = $fournisseurNom;
- return $this;
- }
- /**
- * Get fournisseurNom
- *
- * @return string
- */
- public function getFournisseurNom()
- {
- return $this->fournisseurNom;
- }
- /**
- * Set redacteurCode
- *
- * @param string $redacteurCode
- *
- * @return Commande
- */
- public function setRedacteurCode($redacteurCode)
- {
- $this->redacteurCode = $redacteurCode;
- return $this;
- }
- /**
- * Get redacteurCode
- *
- * @return string
- */
- public function getRedacteurCode()
- {
- return $this->redacteurCode;
- }
- /**
- * Set secteurCode
- *
- * @param string $secteurCode
- *
- * @return Commande
- */
- public function setSecteurCode($secteurCode)
- {
- $this->secteurCode = $secteurCode;
- return $this;
- }
- /**
- * Get secteurCode
- *
- * @return string
- */
- public function getSecteurCode()
- {
- return $this->secteurCode;
- }
- /**
- * Set livraisonNom
- *
- * @param string $livraisonNom
- *
- * @return Commande
- */
- public function setLivraisonNom($livraisonNom)
- {
- $this->livraisonNom = $livraisonNom;
- return $this;
- }
- /**
- * Get livraisonNom
- *
- * @return string
- */
- public function getLivraisonNom()
- {
- return $this->livraisonNom;
- }
- /**
- * Set livraisonAdresse
- *
- * @param string $livraisonAdresse
- *
- * @return Commande
- */
- public function setLivraisonAdresse($livraisonAdresse)
- {
- $this->livraisonAdresse = $livraisonAdresse;
- return $this;
- }
- /**
- * Get livraisonAdresse
- *
- * @return string
- */
- public function getLivraisonAdresse()
- {
- return $this->livraisonAdresse;
- }
- /**
- * Set livraisonCp
- *
- * @param string $livraisonCp
- *
- * @return Commande
- */
- public function setLivraisonCp($livraisonCp)
- {
- $this->livraisonCp = $livraisonCp;
- return $this;
- }
- /**
- * Get livraisonCp
- *
- * @return string
- */
- public function getLivraisonCp()
- {
- return $this->livraisonCp;
- }
- /**
- * Set livraisonVille
- *
- * @param string $livraisonVille
- *
- * @return Commande
- */
- public function setLivraisonVille($livraisonVille)
- {
- $this->livraisonVille = $livraisonVille;
- return $this;
- }
- /**
- * Get livraisonVille
- *
- * @return string
- */
- public function getLivraisonVille()
- {
- return $this->livraisonVille;
- }
- /**
- * @return Collection
- */
- public function getLignes() {
- return $this->lignes;
- }
- }
- /**
- * @RestView(serializerGroups={"detailLigneCommande"})
- * @RestGet(
- * path = "/ligneCommandes/{id}",
- * name = "show_ligne_commande",
- * requirements = {"id"="d+"}
- * )
- */
- public function getLigneCommandeAction(Request $request)
- {
- $ligneCommande = $this->getDoctrine()
- ->getRepository('AppBundle:LigneCommande')
- ->find($request->get('id'));
- /* @var $ligneCommande LigneCommande */
- $ligneCommande->getCommande();
- if (empty($ligneCommande)) {
- return View::create(['message' => 'Ligne de commande introuvable'], Response::HTTP_OK);
- } else {
- return $ligneCommande;
- }
- }
- {
- "id": 1,
- "commande": {
- "numero": "CF000001",
- "date": "2017-10-13T00:00:00+00:00",
- "chantier": 1,
- "fournisseur_code": "F000001",
- "fournisseur_nom": "Fournisseur A",
- "redacteur_code": "FTOMA",
- "secteur_code": "1",
- "livraison_nom": "Nom livraison",
- "livraison_adresse": "Adresse livraison",
- "livraison_cp": "74940",
- "livraison_ville": "Ville livraison"
- },
- "article": {},
- "libelle": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
- "unite": "TL",
- "qte_commande": 10,
- "qte_recue": 8,
- "qte_arecevoir": 2,
- "identifiant": 1
- }
- {
- "id": 1,
- "commande": {},
- "article": {},
- "libelle": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
- "unite": "TL",
- "qte_commande": 10,
- "qte_recue": 8,
- "qte_arecevoir": 2,
- "identifiant": 1
- }
Add Comment
Please, Sign In to add comment