src/Entity/ReportedItems.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\CommonTrait;
  4. use App\Repository\ReportedItemsRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ReportedItemsRepository::class)
  9.  * @ORM\Table(name="itm_reported_items")
  10.  * @ORM\HasLifecycleCallbacks()
  11.  * @UniqueEntity({"uuid"})
  12.  */
  13. class ReportedItems
  14. {
  15.     const OK 'reported.ok';
  16.     const NOK 'reported.nok';
  17.     const VALIDATION_STATUS_FILTER = [
  18.         'Treść dozwolona' => self::OK,
  19.         'Treść niedozwolona' => self::NOK
  20.     ];
  21.     const VALIDATION_STATUS = [
  22.         self::OK => 'Treść dozwolona',
  23.         self::NOK => 'Treść niedozwolona'
  24.     ];
  25.     use CommonTrait;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=Item::class)
  28.      * @ORM\JoinColumn(nullable=false)
  29.      */
  30.     private $item;
  31.     /**
  32.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="reportedItems")
  33.      * @ORM\JoinColumn(nullable=false)
  34.      */
  35.     private $author;
  36.     /**
  37.      * @ORM\Column(type="boolean", nullable=true)
  38.      */
  39.     private $isValidated;
  40.     /**
  41.      * @ORM\Column(type="string", length=255, nullable=true)
  42.      */
  43.     private $validationStatus;
  44.     /**
  45.      * @ORM\Column(type="text", nullable=true)
  46.      */
  47.     private $description;
  48.     public function getItem(): ?Item
  49.     {
  50.         return $this->item;
  51.     }
  52.     public function setItem(?Item $item): self
  53.     {
  54.         $this->item $item;
  55.         return $this;
  56.     }
  57.     public function getAuthor(): ?User
  58.     {
  59.         return $this->author;
  60.     }
  61.     public function setAuthor(?User $author): self
  62.     {
  63.         $this->author $author;
  64.         return $this;
  65.     }
  66.     public function getIsValidated(): ?bool
  67.     {
  68.         return $this->isValidated;
  69.     }
  70.     public function setIsValidated(?bool $isValidated): self
  71.     {
  72.         $this->isValidated $isValidated;
  73.         return $this;
  74.     }
  75.     public function getValidationStatus(): ?string
  76.     {
  77.         return $this->validationStatus;
  78.     }
  79.     public function setValidationStatus(?string $validationStatus): self
  80.     {
  81.         $this->validationStatus $validationStatus;
  82.         return $this;
  83.     }
  84.     public function getDescription(): ?string
  85.     {
  86.         return $this->description;
  87.     }
  88.     public function setDescription(?string $description): self
  89.     {
  90.         $this->description $description;
  91.         return $this;
  92.     }
  93.     public function getValidationStatusIcon() {
  94.         if($this->validationStatus == self::NOK) {
  95.             return '<span class="badge badge-danger">'.self::VALIDATION_STATUS[$this->validationStatus].'</span>';
  96.         } else {
  97.             return '<span class="badge badge-success">'.self::VALIDATION_STATUS[$this->validationStatus].'</span>';
  98.         }
  99.     }
  100. }