src/Entity/ReviewForm.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ReviewFormRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Ramsey\Uuid\Doctrine\UuidGenerator;
  9. #[ORM\Entity(repositoryClassReviewFormRepository::class)]
  10. class ReviewForm
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\Column(type'uuid'uniquetrue)]
  14.     #[ORM\GeneratedValue(strategy'CUSTOM')]
  15.     #[ORM\CustomIdGenerator(class: UuidGenerator::class)]
  16.     private ?\Ramsey\Uuid\UuidInterface $id null;
  17.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  18.     private ?\DateTimeInterface $createdAt null;
  19.     #[ORM\Column(length255)]
  20.     private ?string $name null;
  21.     #[ORM\OneToMany(targetEntityDimension::class, mappedBy'reviewForm')]
  22.     private Collection $dimensions;
  23.     public function __construct()
  24.     {
  25.         $this->createdAt = new \DateTime();
  26.         $this->dimensions = new ArrayCollection();
  27.     }
  28.     public function getId(): ?\Ramsey\Uuid\UuidInterface
  29.     {
  30.         return $this->id;
  31.     }
  32.     public function getCreatedAt(): ?\DateTimeInterface
  33.     {
  34.         return $this->createdAt;
  35.     }
  36.     public function setCreatedAt(\DateTimeInterface $createdAt): static
  37.     {
  38.         $this->createdAt $createdAt;
  39.         return $this;
  40.     }
  41.     public function getName(): ?string
  42.     {
  43.         return $this->name;
  44.     }
  45.     public function setName(string $name): static
  46.     {
  47.         $this->name $name;
  48.         return $this;
  49.     }
  50.     /**
  51.      * @return Collection<int, Dimension>
  52.      */
  53.     public function getDimensions(): Collection
  54.     {
  55.         return $this->dimensions;
  56.     }
  57.     public function addDimension(Dimension $dimension): static
  58.     {
  59.         if (!$this->dimensions->contains($dimension)) {
  60.             $this->dimensions->add($dimension);
  61.             $dimension->setReviewForm($this);
  62.         }
  63.         return $this;
  64.     }
  65.     public function removeDimension(Dimension $dimension): static
  66.     {
  67.         if ($this->dimensions->removeElement($dimension)) {
  68.             // set the owning side to null (unless already changed)
  69.             if ($dimension->getReviewForm() === $this) {
  70.                 $dimension->setReviewForm(null);
  71.             }
  72.         }
  73.         return $this;
  74.     }
  75. }