src/Entity/Publication.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PublicationRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassPublicationRepository::class)]
  8. class Publication
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255nullabletrue)]
  15.     private ?string $title null;
  16.     #[ORM\Column(length255nullabletrue)]
  17.     private ?string $booktitle null;
  18.     #[ORM\Column(length255nullabletrue)]
  19.     private ?string $pages null;
  20.     #[ORM\Column(length255nullabletrue)]
  21.     private ?string $year null;
  22.     #[ORM\Column(length255nullabletrue)]
  23.     private ?string $organization null;
  24.     #[ORM\ManyToMany(targetEntityEncadrement::class, inversedBy'publications')]
  25.     private Collection $authors;
  26.     public function __construct()
  27.     {
  28.         $this->authors = new ArrayCollection();
  29.     }
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getTitle(): ?string
  35.     {
  36.         return $this->title;
  37.     }
  38.     public function setTitle(?string $title): self
  39.     {
  40.         $this->title $title;
  41.         return $this;
  42.     }
  43.     public function getBooktitle(): ?string
  44.     {
  45.         return $this->booktitle;
  46.     }
  47.     public function setBooktitle(?string $booktitle): self
  48.     {
  49.         $this->booktitle $booktitle;
  50.         return $this;
  51.     }
  52.     public function getPages(): ?string
  53.     {
  54.         return $this->pages;
  55.     }
  56.     public function setPages(?string $pages): self
  57.     {
  58.         $this->pages $pages;
  59.         return $this;
  60.     }
  61.     public function getYear(): ?string
  62.     {
  63.         return $this->year;
  64.     }
  65.     public function setYear(?string $year): self
  66.     {
  67.         $this->year $year;
  68.         return $this;
  69.     }
  70.     public function getOrganization(): ?string
  71.     {
  72.         return $this->organization;
  73.     }
  74.     public function setOrganization(?string $organization): self
  75.     {
  76.         $this->organization $organization;
  77.         return $this;
  78.     }
  79.     /**
  80.      * @return Collection<int, Encadrement>
  81.      */
  82.     public function getAuthors(): Collection
  83.     {
  84.         return $this->authors;
  85.     }
  86.     public function addAuthor(Encadrement $author): self
  87.     {
  88.         if (!$this->authors->contains($author)) {
  89.             $this->authors->add($author);
  90.         }
  91.         return $this;
  92.     }
  93.     public function removeAuthor(Encadrement $author): self
  94.     {
  95.         $this->authors->removeElement($author);
  96.         return $this;
  97.     }
  98. }