src/Entity/Resources.php line 10

Open in your IDE?
  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
  8. {
  9.     public function __construct(){
  10.       $this->createdAt = new \DateTime;
  11.       $this->date = new \DateTime;
  12.       $this->isImportant false;
  13.   }
  14.     /**
  15.      * @var int
  16.      *
  17.      * @ORM\Column(name="id", type="integer")
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue(strategy="AUTO")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="string", length=255,nullable=true)
  24.      */
  25.     private $title;
  26.     /**
  27.      * @ORM\OneToOne(targetEntity="App\Entity\File", cascade={"persist","remove"}, orphanRemoval=true, fetch="EAGER")
  28.      * @ORM\JoinColumn(nullable=true)
  29.      */
  30.     private $document;
  31.     /**
  32.      * @ORM\OneToOne(targetEntity="App\Entity\Picture", cascade={"persist","remove"}, orphanRemoval=true, fetch="EAGER")
  33.      * @ORM\JoinColumn(nullable=true)
  34.      */
  35.     private $cover;
  36.     /**
  37.      * @ORM\Column(name="description", type="text", nullable=true)
  38.      */
  39.     private $description;
  40.     /**
  41.      * @ORM\Column(name="isEnabled", type="boolean",nullable=true)
  42.      */
  43.     private $isEnabled;
  44.     /**
  45.      * @ORM\ManyToOne(targetEntity=ResourcesCategories::class, inversedBy="resources", fetch="EAGER")
  46.      * @ORM\JoinColumn(nullable=true)
  47.      */
  48.     private $category;
  49.     /**
  50.      * @ORM\Column(name="createdAt", type="datetime", nullable=true)
  51.      */
  52.     private $createdAt;
  53.     /**
  54.      * @ORM\ManyToOne(targetEntity="App\Entity\Users")
  55.      * @ORM\JoinColumn(name="createdBy",nullable=true)
  56.      */
  57.     private $createdBy;
  58.     /**
  59.      * @ORM\ManyToOne(targetEntity="App\Entity\Users")
  60.      * @ORM\JoinColumn(name="updatedBy",nullable=true)
  61.      */
  62.     private $updatedBy;
  63.     /**
  64.      * @ORM\Column(type="date", nullable=true)
  65.      */
  66.     private $date;
  67.     public function getId(): ?int
  68.     {
  69.         return $this->id;
  70.     }
  71.     public function getTitle(): ?string
  72.     {
  73.         return $this->title;
  74.     }
  75.     public function setTitle(?string $title): self
  76.     {
  77.         $this->title $title;
  78.         return $this;
  79.     }
  80.     public function getDescription(): ?string
  81.     {
  82.         return $this->description;
  83.     }
  84.     public function setDescription(?string $description): self
  85.     {
  86.         $this->description $description;
  87.         return $this;
  88.     }
  89.     public function getLastUpdate(): ?\DateTimeInterface
  90.     {
  91.         return $this->lastUpdate;
  92.     }
  93.     public function setLastUpdate(\DateTimeInterface $lastUpdate): self
  94.     {
  95.         $this->lastUpdate $lastUpdate;
  96.         return $this;
  97.     }
  98.     public function getCreatedAt(): ?\DateTimeInterface
  99.     {
  100.         return $this->createdAt;
  101.     }
  102.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  103.     {
  104.         $this->createdAt $createdAt;
  105.         return $this;
  106.     }
  107.     public function getCreatedBy(): ?Users
  108.     {
  109.         return $this->createdBy;
  110.     }
  111.     public function setCreatedBy(?Users $createdBy): self
  112.     {
  113.         $this->createdBy $createdBy;
  114.         return $this;
  115.     }
  116.     public function getUpdatedBy(): ?Users
  117.     {
  118.         return $this->updatedBy;
  119.     }
  120.     public function setUpdatedBy(?Users $updatedBy): self
  121.     {
  122.         $this->updatedBy $updatedBy;
  123.         return $this;
  124.     }
  125.     public function getIsEnabled(): ?bool
  126.     {
  127.         return $this->isEnabled;
  128.     }
  129.     public function setIsEnabled(?bool $isEnabled): self
  130.     {
  131.         $this->isEnabled $isEnabled;
  132.         return $this;
  133.     }
  134.     public function getDocument(): ?File
  135.     {
  136.         return $this->document;
  137.     }
  138.     public function setDocument(?File $document): self
  139.     {
  140.         if($document->getTarget()){
  141.             $this->document $document;
  142.             $this->document->setDir('upload/files/resources');
  143.         }
  144.         return $this;
  145.     }
  146.     public function getCover(): ?Picture
  147.     {
  148.         return $this->cover;
  149.     }
  150.     public function setCover(?Picture $cover): self
  151.     {
  152.         if($cover->getTarget()){
  153.             $this->cover $cover;
  154.             $this->cover->setDir('upload/images/resources');
  155.             $this->cover->setThumbnailDir('upload/thumbnails/resources');
  156.         }
  157.         return $this;
  158.     }
  159.     public function getCategory(): ?ResourcesCategories
  160.     {
  161.         return $this->category;
  162.     }
  163.     public function setCategory(?ResourcesCategories $category): self
  164.     {
  165.         $this->category $category;
  166.         return $this;
  167.     }
  168.     public function getDate(): ?\DateTimeInterface
  169.     {
  170.         return $this->date;
  171.     }
  172.     public function setDate(?\DateTimeInterface $date): self
  173.     {
  174.         $this->date $date;
  175.         return $this;
  176.     }
  177. }