<?php
namespace App\Entity;
use App\Repository\ImageRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ImageRepository::class)]
class Image
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\OneToOne(mappedBy: 'image', cascade: ['persist', 'remove'])]
private ?Sujet $sujet = null;
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getSujet(): ?Sujet
{
return $this->sujet;
}
public function setSujet(?Sujet $sujet): static
{
// unset the owning side of the relation if necessary
if ($sujet === null && $this->sujet !== null) {
$this->sujet->setImage(null);
}
// set the owning side of the relation if necessary
if ($sujet !== null && $sujet->getImage() !== $this) {
$sujet->setImage($this);
}
$this->sujet = $sujet;
return $this;
}
}