src/Entity/artists.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ArtistsRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ArtistsRepository::class)
  10.  */
  11. class artists
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     public $id;
  19.     /**
  20.      * @ORM\Column(type="text", length=100)
  21.      * @ORM\OneToMany(targetEntity="battlepool", mappedBy="artist")
  22.      */
  23.     public $artist;
  24.     /**
  25.      * @ORM\Column(type="text", length=250)
  26.      */
  27.     public $streamlink;
  28.     /**
  29.      * @ORM\Column(type="datetime")
  30.      */
  31.     protected $registration_date;
  32.     /**
  33.      * @ORM\Column(type="text", length=100)
  34.      */
  35.     private $email;
  36.     /**
  37.      * @ORM\Column(type="text", length=60)
  38.      */
  39.     private $ip;
  40.     /**
  41.      * @ORM\Column(type="integer")
  42.      * @ORM\GeneratedValue(strategy="AUTO")
  43.      */
  44.     public $blocked;
  45.     /**
  46.      * @ORM\Column(type="integer")
  47.      */
  48.     public $allow_battle_invites;
  49.     /**
  50.      * @ORM\Column(type="integer")
  51.      */
  52.     public $judge;
  53.     /**
  54.      * @ORM\Column(type="string", nullable=true)
  55.      * @Assert\File(mimeTypes={ "image/png", "image/jpeg" })
  56.      */
  57.     public $image;
  58.     public function getId(): ?int
  59.     {
  60.         return $this->id;
  61.     }
  62.     public function getArtist(): ?string
  63.     {
  64.         return $this->artist;
  65.     }
  66.     public function setArtist(string $artist): self
  67.     {
  68.         $this->artist $artist;
  69.         return $this;
  70.     }
  71.     public function getRegistration_date(): ?\DateTimeInterface
  72.     {
  73.         return $this->registration_date;
  74.     }
  75.     public function setRegistration_date(\DateTimeInterface $registration_date): self
  76.     {
  77.         $this->registration_date $registration_date;
  78.         return $this;
  79.     }
  80.     public function getEmail(): ?string
  81.     {
  82.         return $this->email;
  83.     }
  84.     public function setEmail(string $email): self
  85.     {
  86.         $this->email $email;
  87.         return $this;
  88.     }
  89.     public function getIp(): ?string
  90.     {
  91.         return $this->ip;
  92.     }
  93.     public function setIp(string $ip): self
  94.     {
  95.         $this->ip $ip;
  96.         return $this;
  97.     }
  98.     public function getBlocked(): ?int
  99.     {
  100.         return $this->blocked;
  101.     }
  102.     public function setBlocked(int $blocked): self
  103.     {
  104.         $this->blocked $blocked;
  105.         return $this;
  106.     }
  107.     public function getAllowBattleInvites(): ?int
  108.     {
  109.         return $this->allow_battle_invites;
  110.     }
  111.     public function setAllowBattleInvites(int $allow_battle_invites): self
  112.     {
  113.         $this->allow_battle_invites $allow_battle_invites;
  114.         return $this;
  115.     }
  116.     public function getImage(): ?string
  117.     {
  118.         return $this->image;
  119.     }
  120.     public function setImage(?string $image): self
  121.     {
  122.         $this->image $image;
  123.         return $this;
  124.     }
  125.     public function __construct()
  126.     {
  127.         $this->registration_date = new \DateTime();
  128.         if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
  129.             $ip $_SERVER['HTTP_CLIENT_IP'];
  130.         } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
  131.             $ip $_SERVER['HTTP_X_FORWARDED_FOR'];
  132.         } else {
  133.             $ip $_SERVER['REMOTE_ADDR'];
  134.         }
  135.         $this->ip $ip;
  136.         $this->blocked 0;
  137.         $this->judge 0;
  138.         $this->allow_battle_invites 0;
  139.     }
  140.     public function getStreamlink(): ?string
  141.     {
  142.         return $this->streamlink;
  143.     }
  144.     public function setStreamlink(string $streamlink): self
  145.     {
  146.         $this->streamlink $streamlink;
  147.         return $this;
  148.     }
  149.     public function getRegistrationDate(): ?\DateTimeInterface
  150.     {
  151.         return $this->registration_date;
  152.     }
  153.     public function setRegistrationDate(\DateTimeInterface $registration_date): self
  154.     {
  155.         $this->registration_date $registration_date;
  156.         return $this;
  157.     }
  158.     public function getJudge(): ?int
  159.     {
  160.         return $this->judge;
  161.     }
  162.     public function setJudge(int $judge): self
  163.     {
  164.         $this->judge $judge;
  165.         return $this;
  166.     }
  167. }