src/Entity/Image.php line 9

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ImageRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClassImageRepository::class)]
  6. class Image
  7. {
  8.     #[ORM\Id]
  9.     #[ORM\GeneratedValue]
  10.     #[ORM\Column]
  11.     private ?int $id null;
  12.     #[ORM\Column(length255)]
  13.     private ?string $name null;
  14.     #[ORM\OneToOne(mappedBy'image'cascade: ['persist''remove'])]
  15.     private ?Sujet $sujet null;
  16.     public function getId(): ?int
  17.     {
  18.         return $this->id;
  19.     }
  20.     public function getName(): ?string
  21.     {
  22.         return $this->name;
  23.     }
  24.     public function setName(string $name): static
  25.     {
  26.         $this->name $name;
  27.         return $this;
  28.     }
  29.     public function getSujet(): ?Sujet
  30.     {
  31.         return $this->sujet;
  32.     }
  33.     public function setSujet(?Sujet $sujet): static
  34.     {
  35.         // unset the owning side of the relation if necessary
  36.         if ($sujet === null && $this->sujet !== null) {
  37.             $this->sujet->setImage(null);
  38.         }
  39.         // set the owning side of the relation if necessary
  40.         if ($sujet !== null && $sujet->getImage() !== $this) {
  41.             $sujet->setImage($this);
  42.         }
  43.         $this->sujet $sujet;
  44.         return $this;
  45.     }
  46. }