<?php
declare(strict_types=1);
namespace Croisiland\CommonBundle\Entity\Ship;
use Crea\ToolsBundle\Entity\LifecycleUserIdentifierTrait;
use Croisiland\CommonBundle\Entity\Company\Atmosphere;
use Croisiland\CommonBundle\Repository\Ship\OnBoardLifeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=OnBoardLifeRepository::class)
*/
class OnBoardLife
{
use LifecycleUserIdentifierTrait;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
private ?int $id;
/**
* @ORM\Column(type="string", length=255)
*/
private string $name;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $description;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $thematic;
/**
* @ORM\Column(type="smallint", nullable=true)
*/
private ?int $minAge;
/**
* @ORM\Column(type="smallint", nullable=true)
*/
private ?int $maxAge;
/**
* @var Collection<int, OnBoardLifeCategory>
*
* @ORM\ManyToMany(targetEntity=OnBoardLifeCategory::class, inversedBy="onBoardLives")
*/
private Collection $categories;
/**
* @ORM\ManyToOne(targetEntity=Atmosphere::class, inversedBy="onBoardLives")
*/
private ?Atmosphere $atmosphere;
/**
* @var Collection<int, Ship>
*
* @ORM\ManyToMany(targetEntity=Ship::class, inversedBy="onBoardLives")
*/
private Collection $ships;
public function __construct()
{
$this->categories = new ArrayCollection();
$this->ships = new ArrayCollection();
}
public function getId(): ?int
{
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 setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getThematic(): ?string
{
return $this->thematic;
}
public function setThematic(?string $thematic): self
{
$this->thematic = $thematic;
return $this;
}
public function getMinAge(): ?int
{
return $this->minAge;
}
public function setMinAge(?int $minAge): self
{
$this->minAge = $minAge;
return $this;
}
public function getMaxAge(): ?int
{
return $this->maxAge;
}
public function setMaxAge(?int $maxAge): self
{
$this->maxAge = $maxAge;
return $this;
}
/**
* @return Collection<int, OnBoardLifeCategory>
*/
public function getCategories(): Collection
{
return $this->categories;
}
public function addCategory(OnBoardLifeCategory $category): self
{
if (!$this->categories->contains($category)) {
$this->categories[] = $category;
}
return $this;
}
public function removeCategory(OnBoardLifeCategory $category): self
{
$this->categories->removeElement($category);
return $this;
}
public function getAtmosphere(): ?Atmosphere
{
return $this->atmosphere;
}
public function setAtmosphere(?Atmosphere $atmosphere): self
{
$this->atmosphere = $atmosphere;
return $this;
}
/**
* @return Collection<int, Ship>
*/
public function getShips(): Collection
{
return $this->ships;
}
public function addShip(Ship $ship): self
{
if (!$this->ships->contains($ship)) {
$this->ships[] = $ship;
}
return $this;
}
public function removeShip(Ship $ship): self
{
$this->ships->removeElement($ship);
return $this;
}
}