src/Entity/Actualiters.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  4. use App\Entity\AccountingFirm;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. use App\Repository\ActualitersRepository;
  8. use Vich\UploaderBundle\Form\Type\VichImageType;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. use Vich\UploaderBundle\Mapping\Annotation\UploadableField;
  11. use Symfony\Component\HttpFoundation\File\File;
  12. use Doctrine\Common\Collections\ArrayCollection;
  13. use Doctrine\Common\Collections\Collection;
  14. /**
  15.  * Actualiters
  16.  *
  17.  * @Vich\Uploadable
  18.  */
  19. #[ORM\Entity(repositoryClassActualitersRepository::class)]
  20. class Actualiters
  21. {
  22.     #[ORM\Id]
  23.     #[ORM\GeneratedValue]
  24.     #[ORM\Column(type'integer')]
  25.     private $id;
  26.     #[ORM\Column(type'string'length255)]
  27.     #[Assert\NotBlank]
  28.     private $titre;
  29.     #[ORM\Column(type'text')]
  30.     private $descriptif;
  31.     #[ORM\ManyToOne(targetEntityAccountingFirm::class, inversedBy'actualiters')]
  32.     #[ORM\JoinColumn(nullablefalse)]
  33.     private $accountingFirm;
  34. /**
  35.      * @Gedmo\Slug(fields={"titre"})
  36.      */
  37.     #[ORM\Column(nullabletrue)]
  38.     private $slug;
  39.     #[ORM\OneToMany(targetEntityImage::class, mappedBy'actualiters'cascade: ['all'])]
  40.     private $images;
  41.     public function __construct()
  42.     {
  43.         $this->images = new ArrayCollection();
  44.     }
  45.     public function getId(): ?int
  46.     {
  47.         return $this->id;
  48.     }
  49.     public function getTitre(): ?string
  50.     {
  51.         return $this->titre;
  52.     }
  53.     public function setTitre(string $titre): self
  54.     {
  55.         $this->titre $titre;
  56.         return $this;
  57.     }
  58.     public function getDescriptif(): ?string
  59.     {
  60.         return $this->descriptif;
  61.     }
  62.     public function setDescriptif(string $descriptif): self
  63.     {
  64.         $this->descriptif $descriptif;
  65.         return $this;
  66.     }
  67.     public function getAccountingFirm(): ?AccountingFirm
  68.     {
  69.         return $this->accountingFirm;
  70.     }
  71.     public function setAccountingFirm(?AccountingFirm $accountingFirm): self
  72.     {
  73.         $this->accountingFirm $accountingFirm;
  74.         return $this;
  75.     }
  76.     public function getSlug()
  77.     {
  78.         return $this->slug;
  79.     }
  80.     /**
  81.      * @return Collection|Image[]
  82.      */
  83.     public function getImages(): Collection
  84.     {
  85.         return $this->images;
  86.     }
  87.     public function addImage(Image $image): self
  88.     {
  89.         if (!$this->images->contains($image)) {
  90.             $this->images[] = $image;
  91.             $image->setActualiters($this);
  92.         }
  93.         return $this;
  94.     }
  95.     public function removeImage(Image $image): self
  96.     {
  97.         dump($image);
  98.         if ($this->images->removeElement($image)) {
  99.             // set the owning side to null (unless already changed)
  100.             if ($image->getActualiters() === $this) {
  101.                 $image->setActualiters(null);
  102.             }
  103.         }
  104.         return $this;
  105.     }
  106. }