<?php
namespace App\Entity\Location;
use App\Entity\Tag;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
#[ORM\Table(name:"locations")]
class Location
{
#[ORM\Id]
#[ORM\Column(type: 'uuid', unique: true)]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private $name;
#[ORM\Column(type: 'text')]
private $description;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $short_description;
#[ORM\Column(type: 'text')]
private $hidden_description;
#[ORM\Column(type: 'uuid', nullable: true)]
private $glued_to;
#[ORM\Column(type: 'string', length: 50)]
private $type;
#[ORM\ManyToMany(targetEntity: 'App\Entity\Tag')]
#[ORM\JoinTable(
name: 'location_tags',
joinColumns: [new ORM\JoinColumn(name: 'location_id', referencedColumnName: 'id')],
inverseJoinColumns: [new ORM\JoinColumn(name: 'tag_id', referencedColumnName: 'id')]
)]
private Collection $tags;
#[ORM\ManyToOne(targetEntity: 'App\Entity\World', inversedBy: 'locations')]
#[ORM\JoinColumn(nullable: false)]
private $world;
public function __construct(
string $name,
string $description,
string $short_description,
) {
$this->name = $name;
$this->description = $description;
// $this->npcs = new ArrayCollection();
$this->tags = new ArrayCollection();
$this->short_description = $short_description;
}
public function getShortDescription(): ?string
{
return $this->short_description;
}
// Getters and setters
public function getId(): ?string
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setShortDescription(?string $shortDescription): self
{
$this->short_description = $shortDescription;
return $this;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
public function getHiddenDescription(): ?string
{
return $this->hidden_description;
}
public function setHiddenDescription(string $hidden_description): self
{
$this->hidden_description = $hidden_description;
return $this;
}
public function getGluedTo(): ?string
{
return $this->glued_to;
}
public function setGluedTo(?string $glued_to): self
{
$this->glued_to = $glued_to;
return $this;
}
public function getTags(): Collection
{
return $this->tags;
}
public function addTag(Tag $tag): void
{
if (!$this->tags->contains($tag)) {
$this->tags->add($tag);
}
}
}