src/Entity/WebsiteNews.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\WebsiteNewsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. #[ORM\Entity(repositoryClassWebsiteNewsRepository::class)]
  10. class WebsiteNews
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column(type'integer')]
  15.     private $id;
  16.     #[ORM\ManyToOne(targetEntityAccountingFirm::class, inversedBy'websiteNews')]
  17.     #[ORM\JoinColumn(nullablefalse)]
  18.     private $accountingFirm;
  19.     #[ORM\Column(type'string'length255)]
  20.     #[Assert\NotBlank]
  21.     private $title;
  22.     #[ORM\Column(type'string'length255nullabletrue)]
  23.     private $seoTitle;
  24.     #[ORM\Column(type'string'length255nullabletrue)]
  25.     private $seoDescription;
  26.     #[ORM\Column(type'string'length255nullabletrue)]
  27.     private $optimizedLink;
  28.     #[ORM\Column(type'text')]
  29.     private $description;
  30.     #[ORM\OneToMany(targetEntityImage::class, mappedBy'websiteNews'cascade: ['all'])]
  31.     private $images;
  32.     #[ORM\OneToMany(targetEntityDocument::class, mappedBy'websiteNews'cascade: ['all'])]
  33.     private $documents;
  34.     #[ORM\OneToMany(targetEntityLink::class, mappedBy'websiteNews'cascade: ['all'])]
  35.     private $links;
  36.     /**
  37.      * @Gedmo\Slug(fields={"title"})
  38.      */
  39.     #[ORM\Column(nullabletrue)]
  40.     private $slug;
  41.     #[ORM\Column(type'datetime'nullabletrue)]
  42.     private $dateadd;
  43.     public function __construct()
  44.     {
  45.         $this->images = new ArrayCollection();
  46.         $this->documents = new ArrayCollection();
  47.         $this->links = new ArrayCollection();
  48.     }
  49.     public function getId(): ?int
  50.     {
  51.         return $this->id;
  52.     }
  53.     public function getAccountingFirm(): ?AccountingFirm
  54.     {
  55.         return $this->accountingFirm;
  56.     }
  57.     public function setAccountingFirm(?AccountingFirm $accountingFirm): self
  58.     {
  59.         $this->accountingFirm $accountingFirm;
  60.         return $this;
  61.     }
  62.     public function getTitle(): ?string
  63.     {
  64.         return $this->title;
  65.     }
  66.     public function setTitle(string $title): self
  67.     {
  68.         $this->title $title;
  69.         return $this;
  70.     }
  71.     public function getSeoTitle(): ?string
  72.     {
  73.         return $this->seoTitle;
  74.     }
  75.     public function setSeoTitle(?string $seoTitle): self
  76.     {
  77.         $this->seoTitle $seoTitle;
  78.         return $this;
  79.     }
  80.     public function getSeoDescription(): ?string
  81.     {
  82.         return $this->seoDescription;
  83.     }
  84.     public function setSeoDescription(?string $seoDescription): self
  85.     {
  86.         $this->seoDescription $seoDescription;
  87.         return $this;
  88.     }
  89.     public function getOptimizedLink(): ?string
  90.     {
  91.         return $this->optimizedLink;
  92.     }
  93.     public function setOptimizedLink(?string $optimizedLink): self
  94.     {
  95.         $this->optimizedLink $optimizedLink;
  96.         return $this;
  97.     }
  98.     public function getDescription(): ?string
  99.     {
  100.         return $this->description;
  101.     }
  102.     public function setDescription(string $description): self
  103.     {
  104.         $this->description $description;
  105.         return $this;
  106.     }
  107.     /**
  108.      * @return Collection|Image[]
  109.      */
  110.     public function getImages(): Collection
  111.     {
  112.         return $this->images;
  113.     }
  114.     public function addImage(Image $image): self
  115.     {
  116.         if (!$this->images->contains($image)) {
  117.             $this->images[] = $image;
  118.             $image->setWebsiteNews($this);
  119.         }
  120.         return $this;
  121.     }
  122.     public function removeImage(Image $image): self
  123.     {
  124.         dump($image);
  125.         if ($this->images->removeElement($image)) {
  126.             // set the owning side to null (unless already changed)
  127.             if ($image->getWebsiteNews() === $this) {
  128.                 $image->setWebsiteNews(null);
  129.             }
  130.         }
  131.         return $this;
  132.     }
  133.     /**
  134.      * @return Collection|Document[]
  135.      */
  136.     public function getDocuments(): Collection
  137.     {
  138.         return $this->documents;
  139.     }
  140.     public function addDocument(Document $document): self
  141.     {
  142.         if (!$this->documents->contains($document)) {
  143.             $this->documents[] = $document;
  144.             $document->setWebsiteNews($this);
  145.         }
  146.         return $this;
  147.     }
  148.     public function removeDocument(Document $document): self
  149.     {
  150.         if ($this->documents->removeElement($document)) {
  151.             // set the owning side to null (unless already changed)
  152.             if ($document->getWebsiteNews() === $this) {
  153.                 $document->setWebsiteNews(null);
  154.             }
  155.         }
  156.         return $this;
  157.     }
  158.     /**
  159.      * @return Collection|Url[]
  160.      */
  161.     public function getLinks(): Collection
  162.     {
  163.         return $this->links;
  164.     }
  165.     public function addLink(Link $link): self
  166.     {
  167.         if (!$this->links->contains($link)) {
  168.             $this->links[] = $link;
  169.             $link->setWebsiteNews($this);
  170.         }
  171.         return $this;
  172.     }
  173.     public function removeLink(Link $link): self
  174.     {
  175.         if ($this->links->removeElement($link)) {
  176.             // set the owning side to null (unless already changed)
  177.             if ($link->getWebsiteNews() === $this) {
  178.                 $link->setWebsiteNews(null);
  179.             }
  180.         }
  181.         return $this;
  182.     }
  183.     public function getSlug()
  184.     {
  185.         return $this->slug;
  186.     }
  187.     public function getDateadd(): ?\DateTimeInterface
  188.     {
  189.         return $this->dateadd;
  190.     }
  191.     public function setDateadd(?\DateTimeInterface $dateadd): self
  192.     {
  193.         $this->dateadd $dateadd;
  194.         return $this;
  195.     }
  196. }