src/Entity/EventType.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClass\App\Repository\EventTypeRepository::class)]
  7. class EventType implements \Stringable
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column(type'integer')]
  12.     private int $id;
  13.     #[ORM\Column(type'string'length255nullabletrue)]
  14.     private ?string $typenull;
  15.     #[ORM\Column(type'string'length255nullabletrue)]
  16.     private ?string $display_namenull;
  17.     #[ORM\ManyToMany(targetEntity\App\Entity\Post::class, mappedBy'event_type')]
  18.     private mixed $posts;
  19.     #[ORM\Column(nullabletrue)]
  20.     private ?int $openagenda_id null;
  21.     public function __construct()
  22.     {
  23.         $this->posts = new ArrayCollection();
  24.     }
  25.     public function getId(): ?int
  26.     {
  27.         return $this->id;
  28.     }
  29.     public function getType(): ?string
  30.     {
  31.         return $this->type;
  32.     }
  33.     public function setType(?string $type): self
  34.     {
  35.         $this->type $type;
  36.         return $this;
  37.     }
  38.     public function getDisplayName(): ?string
  39.     {
  40.         return $this->display_name;
  41.     }
  42.     public function setDisplayName(?string $display_name): self
  43.     {
  44.         $this->display_name $display_name;
  45.         return $this;
  46.     }
  47.     public function __toString(): string
  48.     {
  49.         return (string) $this->display_name;
  50.     }
  51.     /**
  52.      * @return Collection|Post[]
  53.      */
  54.     public function getPosts(): Collection
  55.     {
  56.         return $this->posts;
  57.     }
  58.     public function addPost(Post $post): self
  59.     {
  60.         if (!$this->posts->contains($post)) {
  61.             $this->posts[] = $post;
  62.             $post->addEventType($this);
  63.         }
  64.         return $this;
  65.     }
  66.     public function removePost(Post $post): self
  67.     {
  68.         if ($this->posts->contains($post)) {
  69.             $this->posts->removeElement($post);
  70.             $post->removeEventType($this);
  71.         }
  72.         return $this;
  73.     }
  74.     public function getOpenagendaId(): ?int
  75.     {
  76.         return $this->openagenda_id;
  77.     }
  78.     public function setOpenagendaId(?int $openagenda_id): self
  79.     {
  80.         $this->openagenda_id $openagenda_id;
  81.         return $this;
  82.     }
  83. }