src/Entity/Blog.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Item\ItemCategory;
  4. use App\Entity\Page\Page;
  5. use App\Entity\Traits\IdTrait;
  6. use App\Repository\BlogRepository;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11.  * @ORM\Entity(repositoryClass=BlogRepository::class)
  12.  */
  13. class Blog
  14. {
  15.     use IdTrait;
  16.     /**
  17.      * @ORM\Column(type="text", nullable=true)
  18.      */
  19.     private $content;
  20.     /**
  21.      * @ORM\Column(type="text", nullable=true)
  22.      */
  23.     private $contentEn;
  24.     /**
  25.     * @ORM\Column(type="string", nullable=true)
  26.     */
  27.     private $url;
  28.     /**
  29.     * @ORM\Column(type="string", nullable=true)
  30.     */
  31.     private $fullName;
  32.     /**
  33.     * @ORM\Column(type="string", nullable=true)
  34.     */
  35.     private $passion;
  36.     /**
  37.      * @ORM\ManyToOne(targetEntity="App\Entity\Item\ItemCategory", inversedBy="blog", cascade={"persist","remove"}, fetch="EAGER")
  38.      * @ORM\JoinColumn(nullable=true)
  39.      */
  40.     private $industry;
  41.     /**
  42.      * @ORM\Column(type="string", length=255, nullable=true)
  43.      */
  44.     private $title;
  45.     /**
  46.      * @ORM\Column(type="datetime")
  47.      */
  48.     private $created_at;
  49.     /**
  50.      * @ORM\Column(type="datetime")
  51.      */
  52.     private $updated_at;
  53.     /**
  54.      * @ORM\OneToMany(targetEntity=File::class, mappedBy="blog",cascade={"persist","remove"})
  55.      * @ORM\JoinColumn(nullable=true)
  56.      */
  57.     private $Photo;
  58.     /**
  59.      * @ORM\Column(type="json", nullable=true)
  60.      */
  61.     private $translation = [];
  62.     /**
  63.      * @ORM\Column(type="string", nullable=true)
  64.      */
  65.     private $category;
  66.     /**
  67.      * @ORM\OneToOne(targetEntity=Page::class, cascade={"persist", "remove"})
  68.      * @ORM\JoinColumn(nullable=true)
  69.      */
  70.     private $page;
  71.     public function __construct()
  72.     {
  73.         $this->Photo = new ArrayCollection();
  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 getContentEn(): ?string
  85.     {
  86.         return $this->contentEn;
  87.     }
  88.     public function setContentEn(?string $contentEn): self
  89.     {
  90.         $this->contentEn = $contentEn;
  91.         return $this;
  92.     }
  93.     public function getUrl(): ?string
  94.     {
  95.         return $this->url;
  96.     }
  97.     public function setUrl(?string $url): self
  98.     {
  99.         $this->url = $url;
  100.         return $this;
  101.     }
  102.     public function getTitle(): ?string
  103.     {
  104.         return $this->title;
  105.     }
  106.     public function setTitle(?string $title): self
  107.     {
  108.         $this->title = $title;
  109.         return $this;
  110.     }
  111.     public function getFullName(): ?string
  112.     {
  113.         return $this->fullName;
  114.     }
  115.     public function setFullName(?string $fullName): self
  116.     {
  117.         $this->fullName = $fullName;
  118.         return $this;
  119.     }
  120.     public function getPassion(): ?string
  121.     {
  122.         return $this->passion;
  123.     }
  124.     public function setPassion(?string $passion): self
  125.     {
  126.         $this->passion = $passion;
  127.         return $this;
  128.     }
  129.     public function getCreatedAt(): ?\DateTimeInterface
  130.     {
  131.         return $this->created_at;
  132.     }
  133.     public function setCreatedAt(\DateTimeInterface $created_at): self
  134.     {
  135.         $this->created_at = $created_at;
  136.         return $this;
  137.     }
  138.     public function getUpdatedAt(): ?\DateTimeInterface
  139.     {
  140.         return $this->updated_at;
  141.     }
  142.     public function setUpdatedAt(\DateTimeInterface $updated_at): self
  143.     {
  144.         $this->updated_at = $updated_at;
  145.         return $this;
  146.     }
  147.     public function getIndustry(): ?ItemCategory
  148.     {
  149.         return $this->industry;
  150.     }
  151.     public function setIndustry(?ItemCategory $industry):self
  152.     {
  153.         $this->industry = $industry;
  154.         
  155.         return $this;
  156.     }
  157.     /**
  158.      * @return Collection|File[]
  159.      */
  160.     public function getPhoto(): Collection
  161.     {
  162.         return $this->Photo;
  163.     }
  164.     public function addPhoto(File $photo): self
  165.     {
  166.         if (!$this->Photo->contains($photo)) {
  167.             $this->Photo[] = $photo;
  168.             $photo->setBlog($this);
  169.         }
  170.         return $this;
  171.     }
  172.     public function removePhoto(File $photo): self
  173.     {
  174.         if ($this->Photo->removeElement($photo)) {
  175.             // set the owning side to null (unless already changed)
  176.             if ($photo->getBlog() === $this) {
  177.                 $photo->setBlog(null);
  178.             }
  179.         }
  180.         return $this;
  181.     }
  182.     public function getTranslation(): ?array
  183.     {
  184.         return $this->translation;
  185.     }
  186.     public function setTranslation(?array $translation): self
  187.     {
  188.         $this->translation = $translation;
  189.         return $this;
  190.     }
  191.     public function getCategory(): ?string
  192.     {
  193.         return $this->category;
  194.     }
  195.     public function setCategory(?string $category): self
  196.     {
  197.         $this->category = $category;
  198.         
  199.         return $this;
  200.     }
  201.     public function setPage(?Page $page):self
  202.     {
  203.         $this->page = $page;
  204.         return $this; 
  205.     }
  206.     public function getPage():?Page
  207.     {
  208.         return $this->page;
  209.     }
  210. }