<?php
namespace App\Entity;
use App\Repository\PackageRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=PackageRepository::class)
*/
class Package
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=50)
*/
private $name;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="boolean", options={"default" : 1})
*/
private $status = 1;
/**
* @ORM\OneToMany(targetEntity=Participant::class, mappedBy="package", orphanRemoval=true)
*/
private $participants;
/**
* @ORM\Column(type="string", length=50)
*/
private $secretCode;
public function __construct()
{
$this->participants = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getStatus(): ?bool
{
return $this->status;
}
public function setStatus(bool $status): self
{
$this->status = $status;
return $this;
}
public function __toString()
{
return $this->name;
}
/**
* @return Collection<int, Participant>
*/
public function getParticipants(): Collection
{
return $this->participants;
}
public function addParticipant(Participant $participant): self
{
if (!$this->participants->contains($participant)) {
$this->participants[] = $participant;
$participant->setPackage($this);
}
return $this;
}
public function removeParticipant(Participant $participant): self
{
if ($this->participants->removeElement($participant)) {
// set the owning side to null (unless already changed)
if ($participant->getPackage() === $this) {
$participant->setPackage(null);
}
}
return $this;
}
public function getSecretCode(): ?string
{
return $this->secretCode;
}
public function setSecretCode(string $secretCode): self
{
$this->secretCode = $secretCode;
return $this;
}
}