2018-04-05 15:05:04 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace AppBundle\Entity;
|
|
|
|
|
2018-04-17 16:15:24 +02:00
|
|
|
use AppBundle\Traits\Commentable;
|
2018-04-05 15:05:04 +02:00
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Festival
|
|
|
|
*
|
|
|
|
* @ORM\Table(name="festival")
|
|
|
|
* @ORM\Entity(repositoryClass="AppBundle\Repository\FestivalRepository")
|
|
|
|
*/
|
|
|
|
class Festival {
|
2018-04-17 16:15:24 +02:00
|
|
|
|
|
|
|
use Commentable;
|
2018-04-05 15:05:04 +02:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*
|
|
|
|
* @ORM\Column(name="id", type="integer")
|
|
|
|
* @ORM\Id
|
|
|
|
* @ORM\GeneratedValue(strategy="AUTO")
|
|
|
|
*/
|
|
|
|
private $id;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*
|
|
|
|
* @ORM\Column(name="name", type="string", length=255)
|
|
|
|
*/
|
|
|
|
private $name;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var \DateTime
|
|
|
|
*
|
|
|
|
* @ORM\Column(name="dateCreation", type="datetime")
|
|
|
|
*/
|
|
|
|
private $dateCreation;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var \stdClass
|
|
|
|
*
|
|
|
|
* @ORM\OneToMany(targetEntity="AppBundle\Entity\SellRecord",mappedBy="festival")
|
|
|
|
*/
|
|
|
|
private $sellRecords;
|
|
|
|
|
2018-04-17 15:41:00 +02:00
|
|
|
/**
|
|
|
|
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="festivals")
|
|
|
|
*/
|
|
|
|
private $user;
|
2018-04-05 15:05:04 +02:00
|
|
|
|
2018-04-17 16:15:24 +02:00
|
|
|
/**
|
|
|
|
* @var
|
|
|
|
* @ORM\Column(name="fond_de_caisse_avant", type="float")
|
|
|
|
*/
|
|
|
|
private $fondDeCaisseAvant;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var
|
|
|
|
* @ORM\Column(name="fond_de_caisse_apres", type="float")
|
|
|
|
*/
|
|
|
|
private $fondDeCaisseApres;
|
|
|
|
/**
|
|
|
|
* @var
|
|
|
|
* @ORM\Column(name="chiffre_affaire", type="float")
|
|
|
|
*/
|
|
|
|
private $chiffreAffaire;
|
|
|
|
|
2018-04-19 16:26:48 +02:00
|
|
|
|
|
|
|
public function recalculateChiffreAffaire() {
|
|
|
|
$sellings = $this->getSellRecords();
|
|
|
|
$newChiffreAffaire = 0;
|
|
|
|
foreach ( $sellings as $selling ) {
|
|
|
|
$newChiffreAffaire += $selling->getAmount();
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->setChiffreAffaire( $newChiffreAffaire );
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2018-04-05 15:05:04 +02:00
|
|
|
/**
|
|
|
|
* Get id
|
|
|
|
*
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public function getId() {
|
|
|
|
return $this->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set name
|
|
|
|
*
|
|
|
|
* @param string $name
|
|
|
|
*
|
|
|
|
* @return Festival
|
|
|
|
*/
|
|
|
|
public function setName( $name ) {
|
|
|
|
$this->name = $name;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get name
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getName() {
|
|
|
|
return $this->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set dateCreation
|
|
|
|
*
|
|
|
|
* @param \DateTime $dateCreation
|
|
|
|
*
|
|
|
|
* @return Festival
|
|
|
|
*/
|
|
|
|
public function setDateCreation( $dateCreation ) {
|
|
|
|
$this->dateCreation = $dateCreation;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get dateCreation
|
|
|
|
*
|
|
|
|
* @return \DateTime
|
|
|
|
*/
|
|
|
|
public function getDateCreation() {
|
|
|
|
return $this->dateCreation;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set sellRecords
|
|
|
|
*
|
|
|
|
* @param \stdClass $sellRecords
|
|
|
|
*
|
|
|
|
* @return Festival
|
|
|
|
*/
|
|
|
|
public function setSellRecords( $sellRecords ) {
|
|
|
|
$this->sellRecords = $sellRecords;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get sellRecords
|
|
|
|
*
|
|
|
|
* @return \stdClass
|
|
|
|
*/
|
|
|
|
public function getSellRecords() {
|
|
|
|
return $this->sellRecords;
|
|
|
|
}
|
2018-04-17 15:41:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*/
|
|
|
|
public function __construct() {
|
|
|
|
$this->sellRecords = new \Doctrine\Common\Collections\ArrayCollection();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add sellRecord
|
|
|
|
*
|
|
|
|
* @param \AppBundle\Entity\SellRecord $sellRecord
|
|
|
|
*
|
|
|
|
* @return Festival
|
|
|
|
*/
|
|
|
|
public function addSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
|
|
|
|
$this->sellRecords[] = $sellRecord;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove sellRecord
|
|
|
|
*
|
|
|
|
* @param \AppBundle\Entity\SellRecord $sellRecord
|
|
|
|
*/
|
|
|
|
public function removeSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
|
|
|
|
$this->sellRecords->removeElement( $sellRecord );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set user.
|
|
|
|
*
|
|
|
|
* @param \AppBundle\Entity\User|null $user
|
|
|
|
*
|
|
|
|
* @return Festival
|
|
|
|
*/
|
|
|
|
public function setUser( \AppBundle\Entity\User $user = null ) {
|
|
|
|
$this->user = $user;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get user.
|
|
|
|
*
|
|
|
|
* @return \AppBundle\Entity\User|null
|
|
|
|
*/
|
|
|
|
public function getUser() {
|
|
|
|
return $this->user;
|
|
|
|
}
|
2018-04-17 16:15:24 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set fondDeCaisseAvant.
|
|
|
|
*
|
|
|
|
* @param float $fondDeCaisseAvant
|
|
|
|
*
|
|
|
|
* @return Festival
|
|
|
|
*/
|
|
|
|
public function setFondDeCaisseAvant( $fondDeCaisseAvant ) {
|
|
|
|
$this->fondDeCaisseAvant = $fondDeCaisseAvant;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get fondDeCaisseAvant.
|
|
|
|
*
|
|
|
|
* @return float
|
|
|
|
*/
|
|
|
|
public function getFondDeCaisseAvant() {
|
|
|
|
return $this->fondDeCaisseAvant;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set fondDeCaisseApres.
|
|
|
|
*
|
|
|
|
* @param float $fondDeCaisseApres
|
|
|
|
*
|
|
|
|
* @return Festival
|
|
|
|
*/
|
|
|
|
public function setFondDeCaisseApres( $fondDeCaisseApres ) {
|
|
|
|
$this->fondDeCaisseApres = $fondDeCaisseApres;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get fondDeCaisseApres.
|
|
|
|
*
|
|
|
|
* @return float
|
|
|
|
*/
|
|
|
|
public function getFondDeCaisseApres() {
|
|
|
|
return $this->fondDeCaisseApres;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set chiffreAffaire.
|
|
|
|
*
|
|
|
|
* @param float $chiffreAffaire
|
|
|
|
*
|
|
|
|
* @return Festival
|
|
|
|
*/
|
|
|
|
public function setChiffreAffaire( $chiffreAffaire ) {
|
|
|
|
$this->chiffreAffaire = $chiffreAffaire;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get chiffreAffaire.
|
|
|
|
*
|
|
|
|
* @return float
|
|
|
|
*/
|
|
|
|
public function getChiffreAffaire() {
|
|
|
|
return $this->chiffreAffaire;
|
|
|
|
}
|
2018-04-05 15:05:04 +02:00
|
|
|
}
|