src/Entity/Jury.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\JuryRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  8. use Symfony\Component\Security\Core\User\UserInterface;
  9. #[ORM\Entity(repositoryClassJuryRepository::class)]
  10. class Jury implements UserInterfacePasswordAuthenticatedUserInterface\Serializable
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length128)]
  17.     private ?string $name null;
  18.     #[ORM\Column(length128uniquetrue)]
  19.     private ?string $login null;
  20.     #[ORM\Column(length128)]
  21.     private $password;
  22.     #[ORM\Column(type'json')]
  23.     private $roles = [];
  24.     #[ORM\ManyToMany(targetEntityTheme::class, inversedBy'juries')]
  25.     private Collection $theme;
  26.     #[ORM\ManyToMany(targetEntityTeam::class, inversedBy'juries')]
  27.     private Collection $team;
  28.     #[ORM\Column]
  29.     private ?bool $president null;
  30.     #[ORM\Column]
  31.     private ?bool $enabled null;
  32.     #[ORM\OneToMany(mappedBy'jury'targetEntityResult::class, orphanRemovaltrue)]
  33.     private Collection $results;
  34.     #[ORM\OneToMany(mappedBy'jury'targetEntityComment::class, orphanRemovaltrue)]
  35.     private Collection $comments;
  36.     #[ORM\Column(length10)]
  37.     private ?string $lang null;
  38.     public function __construct()
  39.     {
  40.         $this->theme = new ArrayCollection();
  41.         $this->team = new ArrayCollection();
  42.         $this->results = new ArrayCollection();
  43.         $this->comments = new ArrayCollection();
  44.     }
  45.     public function getId(): ?int
  46.     {
  47.         return $this->id;
  48.     }
  49.     public function getName(): ?string
  50.     {
  51.         return $this->name;
  52.     }
  53.     public function setName(string $name): self
  54.     {
  55.         $this->name $name;
  56.         return $this;
  57.     }
  58.     public function getLang(): ?string
  59.     {
  60.         return $this->lang;
  61.     }
  62.     public function setLang(string $lang): self
  63.     {
  64.         $this->lang $lang;
  65.         return $this;
  66.     }
  67.     /**
  68.      * @return Collection<int, Theme>
  69.      */
  70.     public function getTheme(): Collection
  71.     {
  72.         return $this->theme;
  73.     }
  74.     public function addTheme(Theme $theme): self
  75.     {
  76.         if (!$this->theme->contains($theme)) {
  77.             $this->theme->add($theme);
  78.         }
  79.         return $this;
  80.     }
  81.     public function removeTheme(Theme $theme): self
  82.     {
  83.         $this->theme->removeElement($theme);
  84.         return $this;
  85.     }
  86.     /**
  87.      * @return Collection<int, Team>
  88.      */
  89.     public function getTeam(): Collection
  90.     {
  91.         return $this->team;
  92.     }
  93.     public function addTeam(Team $team): self
  94.     {
  95.         if (!$this->team->contains($team)) {
  96.             $this->team->add($team);
  97.         }
  98.         return $this;
  99.     }
  100.     public function removeTeam(Team $team): self
  101.     {
  102.         $this->team->removeElement($team);
  103.         return $this;
  104.     }
  105.     public function isEnabled(): ?bool
  106.     {
  107.         return $this->enabled;
  108.     }
  109.     public function setEnabled(bool $enabled): self
  110.     {
  111.         $this->enabled $enabled;
  112.         return $this;
  113.     }
  114.     public function isPresident(): ?bool
  115.     {
  116.         return $this->president;
  117.     }
  118.     public function setPresident(bool $president): self
  119.     {
  120.         $this->president $president;
  121.         return $this;
  122.     }
  123.     public function getLogin(): ?string
  124.     {
  125.         return $this->login;
  126.     }
  127.     public function setLogin(string $login): self
  128.     {
  129.         $this->login $login;
  130.         return $this;
  131.     }
  132.     /**
  133.      * A visual identifier that represents this user.
  134.      *
  135.      * @see UserInterface
  136.      */
  137.     public function getUserIdentifier(): string
  138.     {
  139.         return (string) $this->login;
  140.     }
  141.     /**
  142.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  143.      */
  144.     public function getUsername(): string
  145.     {
  146.         return (string) $this->login;
  147.     }
  148.     /**
  149.      * @see UserInterface
  150.      */
  151.     public function getRoles(): array
  152.     {
  153.         $roles $this->roles;
  154.         // guarantee every user at least has ROLE_USER
  155.         $roles[] = 'ROLE_USER';
  156.         return array_unique($roles);
  157.     }
  158.     public function setRoles(array $roles): self
  159.     {
  160.         $this->roles $roles;
  161.         return $this;
  162.     }
  163.     /**
  164.      * @see PasswordAuthenticatedUserInterface
  165.      */
  166.     public function getPassword(): string
  167.     {
  168.         return $this->password;
  169.     }
  170.     public function setPassword(string $password): self
  171.     {
  172.         $this->password $password;
  173.         return $this;
  174.     }
  175.     /**
  176.      * Returning a salt is only needed, if you are not using a modern
  177.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  178.      *
  179.      * @see UserInterface
  180.      */
  181.     public function getSalt(): ?string
  182.     {
  183.         return null;
  184.     }
  185.     /**
  186.      * @see UserInterface
  187.      */
  188.     public function eraseCredentials()
  189.     {
  190.         // If you store any temporary, sensitive data on the user, clear it here
  191.         // $this->plainPassword = null;
  192.     }
  193.     /**
  194.      * @return Collection<int, Result>
  195.      */
  196.     public function getResults(): Collection
  197.     {
  198.         return $this->results;
  199.     }
  200.     public function addResult(Result $result): self
  201.     {
  202.         if (!$this->results->contains($result)) {
  203.             $this->results->add($result);
  204.             $result->setJury($this);
  205.         }
  206.         return $this;
  207.     }
  208.     public function removeResult(Result $result): self
  209.     {
  210.         if ($this->results->removeElement($result)) {
  211.             // set the owning side to null (unless already changed)
  212.             if ($result->getJury() === $this) {
  213.                 $result->setJury(null);
  214.             }
  215.         }
  216.         return $this;
  217.     }
  218.     /**
  219.      * @return Collection<int, Comment>
  220.      */
  221.     public function getComments(): Collection
  222.     {
  223.         return $this->comments;
  224.     }
  225.     public function addComment(Comment $comment): self
  226.     {
  227.         if (!$this->comments->contains($comment)) {
  228.             $this->comments->add($comment);
  229.             $comment->setJury($this);
  230.         }
  231.         return $this;
  232.     }
  233.     public function removeComment(Comment $comment): self
  234.     {
  235.         if ($this->comments->removeElement($comment)) {
  236.             // set the owning side to null (unless already changed)
  237.             if ($comment->getJury() === $this) {
  238.                 $comment->setJury(null);
  239.             }
  240.         }
  241.         return $this;
  242.     }
  243.     public function serialize()
  244.     {
  245.         return serialize(array(
  246.             $this->id,
  247.             $this->login,
  248.             $this->password,
  249.         ));
  250.     }
  251.     public function unserialize(string $data)
  252.     {
  253.         list (
  254.             $this->id,
  255.             $this->login,
  256.             $this->password,
  257.             ) = unserialize($data);
  258.     }
  259. }