<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: \App\Repository\EventTypeRepository::class)]
class EventType implements \Stringable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $type= null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $display_name= null;
#[ORM\ManyToMany(targetEntity: \App\Entity\Post::class, mappedBy: 'event_type')]
private mixed $posts;
#[ORM\Column(nullable: true)]
private ?int $openagenda_id = null;
public function __construct()
{
$this->posts = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getDisplayName(): ?string
{
return $this->display_name;
}
public function setDisplayName(?string $display_name): self
{
$this->display_name = $display_name;
return $this;
}
public function __toString(): string
{
return (string) $this->display_name;
}
/**
* @return Collection|Post[]
*/
public function getPosts(): Collection
{
return $this->posts;
}
public function addPost(Post $post): self
{
if (!$this->posts->contains($post)) {
$this->posts[] = $post;
$post->addEventType($this);
}
return $this;
}
public function removePost(Post $post): self
{
if ($this->posts->contains($post)) {
$this->posts->removeElement($post);
$post->removeEventType($this);
}
return $this;
}
public function getOpenagendaId(): ?int
{
return $this->openagenda_id;
}
public function setOpenagendaId(?int $openagenda_id): self
{
$this->openagenda_id = $openagenda_id;
return $this;
}
}