src/Entity/ChainClub.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ChainClubRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ChainClubRepository::class)
  9.  * @ORM\Table(name="chain_clubs")
  10.  */
  11. class ChainClub
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private ?int $id null;
  19.     /**
  20.      * @ORM\Column(type="string", length=255)
  21.      */
  22.     private string $title "";
  23.     /**
  24.      * @ORM\Column(type="integer", options={"unsigned": true, "default": 86})
  25.      */
  26.     private int $low_percent 86;
  27.     /**
  28.      * @ORM\Column(type="integer", options={"unsigned": true, "default": 90})
  29.      */
  30.     private int $high_percent 90;
  31.     /**
  32.      * @ORM\OneToMany(targetEntity=Club::class, mappedBy="chain")
  33.      */
  34.     private ?Collection $clubs;
  35.     public function __construct()
  36.     {
  37.         $this->clubs = new ArrayCollection();
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getTitle(): ?string
  44.     {
  45.         return $this->title;
  46.     }
  47.     public function setTitle(string $title): self
  48.     {
  49.         $this->title $title;
  50.         return $this;
  51.     }
  52.     public function getLowPercent(): ?int
  53.     {
  54.         return $this->low_percent;
  55.     }
  56.     public function setLowPercent(int $low_percent): self
  57.     {
  58.         $this->low_percent $low_percent;
  59.         return $this;
  60.     }
  61.     public function getHighPercent(): ?int
  62.     {
  63.         return $this->high_percent;
  64.     }
  65.     public function setHighPercent(int $high_percent): self
  66.     {
  67.         $this->high_percent $high_percent;
  68.         return $this;
  69.     }
  70.     /**
  71.      * @return Collection|null
  72.      */
  73.     public function getClubs(): ?Collection
  74.     {
  75.         return $this->clubs;
  76.     }
  77.     public function addClub(Club $club): self
  78.     {
  79.         if (!$this->clubs->contains($club)) {
  80.             $this->clubs[] = $club;
  81.             $club->setChain($this);
  82.         }
  83.         return $this;
  84.     }
  85.     public function removeClub(Club $club): self
  86.     {
  87.         if ($this->clubs->removeElement($club)) {
  88.             // set the owning side to null (unless already changed)
  89.             if ($club->getChain() === $this) {
  90.                 $club->setChain(null);
  91.             }
  92.         }
  93.         return $this;
  94.     }
  95. }