<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\BFChallengeEditionRepository")
*/
class BFChallengeEdition
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\BFChallenge", inversedBy="editions")
* @ORM\JoinColumn(nullable=false)
*/
private $challenge;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\BFEdition", inversedBy="challengeeditions")
* @ORM\OrderBy({"startdate" = "ASC", "enddate"="ASC"})
*/
private $editions;
/**
* @ORM\Column(type="datetime")
*/
private $creationdate;
/**
* @ORM\Column(type="boolean")
*/
private $isactive;
/**
* @ORM\OneToOne(targetEntity="App\Entity\BFDescriptionChallengeEdition", inversedBy="edition", cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=false)
*/
private $description;
public function __construct()
{
$this->editions = new ArrayCollection();
$this->creationdate = new \DateTime('now');
$this->description=new BFDescriptionChallengeEdition();
$this->isactive=false;
}
public function getId(): ?int
{
return $this->id;
}
public function getChallenge(): ?BFChallenge
{
return $this->challenge;
}
public function setChallenge(?BFChallenge $challenge): self
{
$this->challenge = $challenge;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return Collection|BFEdition[]
*/
public function getEditions(): Collection
{
return $this->editions;
}
public function addEdition(BFEdition $edition): self
{
if (!$this->editions->contains($edition)) {
$this->editions[] = $edition;
}
return $this;
}
public function removeEdition(BFEdition $edition): self
{
if ($this->editions->contains($edition)) {
$this->editions->removeElement($edition);
}
return $this;
}
public function getCreationdate(): ?\DateTimeInterface
{
return $this->creationdate;
}
public function setCreationdate(\DateTimeInterface $creationdate): self
{
$this->creationdate = $creationdate;
return $this;
}
public function getDescription(): ?BFDescriptionChallengeEdition
{
return $this->description;
}
public function setDescription(?BFDescriptionChallengeEdition $description): self
{
$this->description = $description;
// set (or unset) the owning side of the relation if necessary
$newEdition = null === $description ? null : $this;
if ($description->getEdition() !== $newEdition) {
$description->setEdition($newEdition);
}
return $this;
}
public function getIsactive(): ?bool
{
return $this->isactive;
}
public function setIsactive(bool $isactive): self
{
$this->isactive = $isactive;
return $this;
}
}