src/Entity/Professions.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProfessionsRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass=ProfessionsRepository::class)
  7.  */
  8. class Professions
  9. {
  10.     public function __construct(){
  11.                  $this->createdAt = new \DateTime;
  12.                  $this->isEnabled false;
  13.              }
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=255, nullable=true)
  22.      */
  23.     private $name;
  24.     /**
  25.      * @ORM\Column(type="text", nullable=true)
  26.      */
  27.     private $description;
  28.     /**
  29.      * @ORM\Column(type="text", nullable=true)
  30.      */
  31.     private $content;
  32.     /**
  33.      * @ORM\Column(type="datetime", nullable=true)
  34.      */
  35.     private $createdAt;
  36.     /**
  37.      * @ORM\ManyToOne(targetEntity=Users::class)
  38.      */
  39.     private $createdBy;
  40.     /**
  41.      * @ORM\Column(type="boolean", nullable=true)
  42.      */
  43.     private $isEnabled;
  44.     /**
  45.      * @ORM\OneToOne(targetEntity="App\Entity\Picture", cascade={"persist","remove"}, orphanRemoval=true, fetch="EAGER")
  46.      * @ORM\JoinColumn(nullable=true)
  47.      */
  48.     private $banner;
  49.     /**
  50.      * @ORM\Column(type="string", length=255, nullable=true)
  51.      */
  52.     private $slug;
  53.     public function getId(): ?int
  54.     {
  55.         return $this->id;
  56.     }
  57.     public function getName(): ?string
  58.     {
  59.         return $this->name;
  60.     }
  61.     public function setName(?string $name): self
  62.     {
  63.         $this->name $name;
  64.         return $this;
  65.     }
  66.     public function getDescription(): ?string
  67.     {
  68.         return $this->description;
  69.     }
  70.     public function setDescription(?string $description): self
  71.     {
  72.         $this->description $description;
  73.         return $this;
  74.     }
  75.     public function getContent(): ?string
  76.     {
  77.         return $this->content;
  78.     }
  79.     public function setContent(?string $content): self
  80.     {
  81.         $this->content $content;
  82.         return $this;
  83.     }
  84.     public function getCreatedAt(): ?\DateTimeInterface
  85.     {
  86.         return $this->createdAt;
  87.     }
  88.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  89.     {
  90.         $this->createdAt $createdAt;
  91.         return $this;
  92.     }
  93.     public function getCreatedBy(): ?Users
  94.     {
  95.         return $this->createdBy;
  96.     }
  97.     public function setCreatedBy(?Users $createdBy): self
  98.     {
  99.         $this->createdBy $createdBy;
  100.         return $this;
  101.     }
  102.     public function getIsEnabled(): ?bool
  103.     {
  104.         return $this->isEnabled;
  105.     }
  106.     public function setIsEnabled(?bool $isEnabled): self
  107.     {
  108.         $this->isEnabled $isEnabled;
  109.         return $this;
  110.     }
  111.     public function getBanner(): ?Picture
  112.     {
  113.         return $this->banner;
  114.     }
  115.     public function setBanner(?Picture $banner): self
  116.     {
  117.         if($banner->getTarget()){
  118.             $this->banner $banner;
  119.             $this->banner->setDir('upload/images/articles/');
  120.             $this->banner->setThumbnailDir('upload/thumbnails/articles/');
  121.         }
  122.         return $this;
  123.     }
  124.     public function getSlug(): ?string
  125.     {
  126.         return $this->slug;
  127.     }
  128.     public function setSlug(?string $slug): self
  129.     {
  130.         $this->slug $slug;
  131.         return $this;
  132.     }
  133. }