src/Entity/BFFestival.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. /**
  8.  * @ORM\Entity(repositoryClass="App\Repository\BFFestivalRepository")
  9.  */
  10. class BFFestival extends AbstractArrayAccess
  11. {
  12.     /**
  13.      * @ORM\Id()
  14.      * @ORM\GeneratedValue()
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\OneToMany(targetEntity="App\Entity\BFEdition", mappedBy="festival", orphanRemoval=true, cascade={"persist"})
  24.      * @ORM\OrderBy({"enddate" = "DESC", "startdate" = "DESC"})
  25.      */
  26.     private $editions;
  27.     /**
  28.      * @ORM\OneToOne(targetEntity="App\Entity\BFDescriptionFestival", inversedBy="festival", cascade={"persist", "remove"})
  29.      * @ORM\JoinColumn(nullable=false)
  30.      */
  31.     private $description;
  32.     /**
  33.      * @ORM\ManyToOne(targetEntity="App\Entity\BFUser", inversedBy="ownedfestivals")
  34.      * @ORM\JoinColumn(onDelete="SET NULL")
  35.      */
  36.     private $owner;
  37.     /**
  38.      * @ORM\ManyToMany(targetEntity="App\Entity\BFUser", inversedBy="administratorfestivals")
  39.      */
  40.     private $administrators;
  41.     /**
  42.      * @ORM\OneToMany(targetEntity="App\Entity\BFAdminLicences", mappedBy="festival", cascade={"persist", "remove"})
  43.      */
  44.     private $BFAdminLicences;
  45.     /**
  46.      * @ORM\OneToOne(targetEntity="App\Entity\BFRouting", mappedBy="festival", cascade={"persist", "remove"})
  47.      */
  48.     private $route;
  49.     /**
  50.      * @ORM\OneToMany(targetEntity="App\Entity\BFSubscription", mappedBy="festival", cascade={"persist", "remove"}, orphanRemoval=true)
  51.      */
  52.     private $subscriptions;
  53.     /**
  54.      * @ORM\OneToMany(targetEntity="App\Entity\BFMailFestival", mappedBy="festival", cascade={"persist", "remove"})
  55.      */
  56.     private $mails;
  57.     /**
  58.      * @ORM\Column(type="datetime", nullable=true)
  59.      */
  60.     private $creationdate;
  61.     /**
  62.      * @ORM\ManyToMany(targetEntity="App\Entity\BFChallenge", mappedBy="festivals")
  63.      */
  64.     private $challenges;
  65.     /**
  66.      * @ORM\Column(type="integer", nullable=true)
  67.      */
  68.     private $orderfeebf;
  69.     /**
  70.      * @ORM\Column(type="string", length=255, nullable=true)
  71.      */
  72.     private $stripeaccountid;
  73.     
  74.     const defaultfee=50;
  75.     public function __construct()
  76.     {
  77.         $this->editions = new ArrayCollection();
  78.         $this->description= new BFDescriptionFestival();
  79.         $this->administrators = new ArrayCollection();
  80.         $this->BFAdminLicences = new ArrayCollection();
  81.         $this->subscriptions = new ArrayCollection();
  82.         $this->mails = new ArrayCollection();
  83.         $this->creationdate = new \DateTime('now');
  84.         $this->challenges = new ArrayCollection();
  85.     }
  86.     public function getId(): ?int
  87.     {
  88.         return $this->id;
  89.     }
  90.     public function getName(): ?string
  91.     {
  92.         return $this->name;
  93.     }
  94.     public function setName(string $name): self
  95.     {
  96.         $this->name $name;
  97.         return $this;
  98.     }
  99.     /**
  100.      * @return Collection|BFEdition[]
  101.      */
  102.     public function getEditions(): Collection
  103.     {
  104.         return $this->editions;
  105.     }
  106.     public function addEdition(BFEdition $edition): self
  107.     {
  108.         if (!$this->editions->contains($edition)) {
  109.             $this->editions[] = $edition;
  110.             $edition->setFestivalid($this);
  111.         }
  112.         return $this;
  113.     }
  114.     public function removeEdition(BFEdition $edition): self
  115.     {
  116.         if ($this->editions->contains($edition)) {
  117.             $this->editions->removeElement($edition);
  118.             // set the owning side to null (unless already changed)
  119.             if ($edition->getFestivalid() === $this) {
  120.                 $edition->setFestivalid(null);
  121.             }
  122.         }
  123.         return $this;
  124.     }
  125.     public function getDescription(): ?BFDescriptionFestival
  126.     {
  127.         return $this->description;
  128.     }
  129.     public function setDescription(BFDescriptionFestival $description): self
  130.     {
  131.         $this->description $description;
  132.         return $this;
  133.     }
  134.     public function getOwner(): ?BFUser
  135.     {
  136.         return $this->owner;
  137.     }
  138.     public function setOwner(?BFUser $owner): self
  139.     {
  140.         $this->owner $owner;
  141.         return $this;
  142.     }
  143.     /**
  144.      * @return Collection|BFUser[]
  145.      */
  146.     public function getAdministrators(): Collection
  147.     {
  148.         return $this->administrators;
  149.     }
  150.     public function addAdministrator(BFUser $administrator): self
  151.     {
  152.         if (!$this->administrators->contains($administrator)) {
  153.             $this->administrators[] = $administrator;
  154.         }
  155.         return $this;
  156.     }
  157.     public function removeAdministrator(BFUser $administrator): self
  158.     {
  159.         if ($this->administrators->contains($administrator)) {
  160.             $this->administrators->removeElement($administrator);
  161.         }
  162.         return $this;
  163.     }
  164.     /**
  165.      * @return Collection|BFAdminLicences[]
  166.      */
  167.     public function getBFAdminLicences(): Collection
  168.     {
  169.         return $this->BFAdminLicences;
  170.     }
  171.     public function addBFAdminLicence(BFAdminLicences $bFAdminLicence): self
  172.     {
  173.         if (!$this->BFAdminLicences->contains($bFAdminLicence)) {
  174.             $this->BFAdminLicences[] = $bFAdminLicence;
  175.             $bFAdminLicence->setFestival($this);
  176.         }
  177.         return $this;
  178.     }
  179.     public function removeBFAdminLicence(BFAdminLicences $bFAdminLicence): self
  180.     {
  181.         if ($this->BFAdminLicences->contains($bFAdminLicence)) {
  182.             $this->BFAdminLicences->removeElement($bFAdminLicence);
  183.             // set the owning side to null (unless already changed)
  184.             if ($bFAdminLicence->getFestival() === $this) {
  185.                 $bFAdminLicence->setFestival(null);
  186.             }
  187.         }
  188.         return $this;
  189.     }
  190.     
  191.     public function getCountActive(): int
  192.     {
  193.         $count=0;
  194.         
  195.         foreach($this->getEditions() as $edition)
  196.         {
  197.             if($edition->getIsactive()==true)
  198.                 $count++;
  199.         }
  200.         
  201.         return $count;
  202.     }
  203.     public function getRoute(): ?BFRouting
  204.     {
  205.         return $this->route;
  206.     }
  207.     public function setRoute(?BFRouting $route): self
  208.     {
  209.         $this->route $route;
  210.         // set (or unset) the owning side of the relation if necessary
  211.         $newFestival null === $route null $this;
  212.         if ($route->getFestival() !== $newFestival) {
  213.             $route->setFestival($newFestival);
  214.         }
  215.         return $this;
  216.     }
  217.     /**
  218.      * @return Collection|BFSubscription[]
  219.      */
  220.     public function getSubscriptions(): Collection
  221.     {
  222.         return $this->subscriptions;
  223.     }
  224.     public function addSubscription(BFSubscription $subscription): self
  225.     {
  226.         if (!$this->subscriptions->contains($subscription)) {
  227.             $this->subscriptions[] = $subscription;
  228.             $subscription->setFestival($this);
  229.         }
  230.         return $this;
  231.     }
  232.     public function removeSubscription(BFSubscription $subscription): self
  233.     {
  234.         if ($this->subscriptions->contains($subscription)) {
  235.             $this->subscriptions->removeElement($subscription);
  236.             // set the owning side to null (unless already changed)
  237.             if ($subscription->getFestival() === $this) {
  238.                 $subscription->setFestival(null);
  239.             }
  240.         }
  241.         return $this;
  242.     }
  243.     /**
  244.      * @return Collection|BFMailFestival[]
  245.      */
  246.     public function getMails(): Collection
  247.     {
  248.         return $this->mails;
  249.     }
  250.     public function addMail(BFMailFestival $mail): self
  251.     {
  252.         if (!$this->mails->contains($mail)) {
  253.             $this->mails[] = $mail;
  254.             $mail->setFestival($this);
  255.         }
  256.         return $this;
  257.     }
  258.     public function removeMail(BFMailFestival $mail): self
  259.     {
  260.         if ($this->mails->contains($mail)) {
  261.             $this->mails->removeElement($mail);
  262.             // set the owning side to null (unless already changed)
  263.             if ($mail->getFestival() === $this) {
  264.                 $mail->setFestival(null);
  265.             }
  266.         }
  267.         return $this;
  268.     }
  269.     public function getCreationdate(): ?\DateTimeInterface
  270.     {
  271.         return $this->creationdate;
  272.     }
  273.     public function setCreationdate(?\DateTimeInterface $creationdate): self
  274.     {
  275.         $this->creationdate $creationdate;
  276.         return $this;
  277.     }
  278.     /**
  279.      * @return Collection|BFChallenge[]
  280.      */
  281.     public function getChallenges(): Collection
  282.     {
  283.         return $this->challenges;
  284.     }
  285.     public function addChallenge(BFChallenge $challenge): self
  286.     {
  287.         if (!$this->challenges->contains($challenge)) {
  288.             $this->challenges[] = $challenge;
  289.             $challenge->addFestival($this);
  290.         }
  291.         return $this;
  292.     }
  293.     public function removeChallenge(BFChallenge $challenge): self
  294.     {
  295.         if ($this->challenges->contains($challenge)) {
  296.             $this->challenges->removeElement($challenge);
  297.             $challenge->removeFestival($this);
  298.         }
  299.         return $this;
  300.     }
  301.     
  302.     public function getNamelist()
  303.     {
  304.         return $this->id."-".$this->name;
  305.     }
  306.     public function getOrderfeebf(): ?int
  307.     {
  308.         if($this->orderfeebf==null)
  309.             return self::defaultfee;
  310.         
  311.         return $this->orderfeebf;
  312.     }
  313.     public function setOrderfeebf(?int $orderfeebf): self
  314.     {
  315.         $this->orderfeebf $orderfeebf;
  316.         return $this;
  317.     }
  318.     public function getStripeaccountid(): ?string
  319.     {
  320.         return $this->stripeaccountid;
  321.     }
  322.     public function setStripeaccountid(?string $stripeaccountid): self
  323.     {
  324.         $this->stripeaccountid $stripeaccountid;
  325.         return $this;
  326.     }
  327.     
  328. }