src/Entity/Resources.php

  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5.  * @ORM\Entity(repositoryClass="App\Repository\ResourcesRepository")
  6.  */
  7. class Resources extends OSEntity
  8. {
  9.     public function __construct(){
  10.         parent::__construct();
  11.         $this->isImportant false;
  12.   }
  13.     /**
  14.      * @ORM\OneToOne(targetEntity="App\Entity\File", cascade={"persist","remove"}, orphanRemoval=true, fetch="EAGER")
  15.      * @ORM\JoinColumn(nullable=true)
  16.      */
  17.     private $document;
  18.     /**
  19.      * @ORM\ManyToOne(targetEntity=ResourcesCategories::class, inversedBy="resources", fetch="EAGER")
  20.      * @ORM\JoinColumn(nullable=true)
  21.      */
  22.     private $category;
  23.     /**
  24.      * @ORM\Column(type="boolean", nullable=true)
  25.      */
  26.     private $isImportant;
  27.     public function getDocument(): ?File
  28.     {
  29.         return $this->document;
  30.     }
  31.     public function setDocument(?File $document): self
  32.     {
  33.         if($document->getTarget()){
  34.             $this->document $document;
  35.             $this->document->setDir('upload/files/resources');
  36.         }
  37.         return $this;
  38.     }
  39.     public function getCover(): ?Picture
  40.     {
  41.         return $this->getBanner();
  42.     }
  43.     public function setCover(?Picture $cover): self
  44.     {
  45.         return $this->setBanner($cover);
  46.     }
  47.     public function getCategory(): ?ResourcesCategories
  48.     {
  49.         return $this->category;
  50.     }
  51.     public function setCategory(?ResourcesCategories $category): self
  52.     {
  53.         $this->category $category;
  54.         return $this;
  55.     }
  56.     public function getIsImportant(): ?bool
  57.     {
  58.         return $this->isImportant;
  59.     }
  60.     public function setIsImportant(?bool $isImportant): self
  61.     {
  62.         $this->isImportant $isImportant;
  63.         return $this;
  64.     }
  65. }