src/Entity/Auteur.php line 12
<?php
namespace App\Entity;
use App\Repository\AuteurRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: AuteurRepository::class)]
class Auteur
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $nom = null;
#[ORM\ManyToMany(targetEntity: Publication::class, mappedBy: 'auteur')]
private Collection $publications;
#[ORM\ManyToOne(inversedBy: 'auteurs')]
private ?Chercheur $chercheur = null;
public function __construct()
{
$this->publications = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(?string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
/**
* @return Collection<int, Publication>
*/
public function getPublications(): Collection
{
return $this->publications;
}
public function addPublication(Publication $publication): self
{
if (!$this->publications->contains($publication)) {
$this->publications->add($publication);
$publication->addAuteur($this);
}
return $this;
}
public function removePublication(Publication $publication): self
{
if ($this->publications->removeElement($publication)) {
$publication->removeAuteur($this);
}
return $this;
}
public function getChercheur(): ?Chercheur
{
return $this->chercheur;
}
public function setChercheur(?Chercheur $chercheur): self
{
$this->chercheur = $chercheur;
return $this;
}
}