<?php
declare(strict_types=1);
namespace Croisiland\CommonBundle\Entity\Company;
use Crea\MediaBundle\Entity\MediaTagOwnerInterface;
use Crea\ToolsBundle\Entity\LifecycleUserIdentifierTrait;
use Crea\ToolsBundle\Traits\KeyValueTrait;
use Croisiland\CommonBundle\Annotation\Company\AtmosphereFormValidator;
use Croisiland\CommonBundle\Entity\Amenity\ServiceAtmosphereAssociation;
use Croisiland\CommonBundle\Entity\Cabin\CabinCategory;
use Croisiland\CommonBundle\Entity\Ship\OnBoardLife;
use Croisiland\CommonBundle\Entity\Traits\IsActiveTrait;
use Croisiland\CommonBundle\Entity\Traits\IsVisibleTrait;
use Croisiland\CommonBundle\Entity\Traits\ListOrderTrait;
use Croisiland\CommonBundle\Repository\Company\AtmosphereRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Util\ClassUtils;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=AtmosphereRepository::class)
*
* @ORM\Table(
* uniqueConstraints={
*
* @ORM\UniqueConstraint(name="atmosphere_code_unique", columns={"code", "company_id"})
* }
* )
*
* @AtmosphereFormValidator(groups={"atmosphere_form_validator"})
*/
class Atmosphere implements MediaTagOwnerInterface
{
use ListOrderTrait;
use IsActiveTrait;
use LifecycleUserIdentifierTrait;
use KeyValueTrait;
// TODO: relations
// private Collection images;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
private ?int $id = null;
/**
* @ORM\Column(type="string", length=255)
*/
private ?string $name = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $marketingName = null;
/**
* @ORM\Column(type="string", length=255)
*/
private ?string $code = null;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $shortDescription = null;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $description = null;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $comment = null;
/**
* @ORM\ManyToOne(targetEntity=Company::class, inversedBy="atmospheres")
*
* @ORM\JoinColumn(nullable=false)
*/
private ?Company $company = null;
/**
* @var Collection<int, CabinCategory>
*
* @ORM\OneToMany(targetEntity=CabinCategory::class, mappedBy="atmosphere")
* @ORM\OrderBy({"listOrder" = "ASC"})
*/
private Collection $cabinCategories;
/**
* @var Collection<int, OnBoardLife>
*
* @ORM\OneToMany(targetEntity=OnBoardLife::class, mappedBy="atmosphere")
*/
private Collection $onBoardLives;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $included = null;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $excluded = null;
/**
* @var Collection<int, ServiceAtmosphereAssociation>
*
* @ORM\OneToMany(targetEntity=ServiceAtmosphereAssociation::class, mappedBy="atmosphere", orphanRemoval=true, cascade={"persist","remove"})
*/
private Collection $serviceAtmosphereAssociations;
/**
* @ORM\ManyToOne(targetEntity=Atmosphere::class)
* @ORM\JoinColumn(nullable=true)
*/
private ?Atmosphere $inheritsServicesFrom = null;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $reassignment = null;
public function __construct()
{
$this->cabinCategories = new ArrayCollection();
$this->onBoardLives = new ArrayCollection();
$this->serviceAtmosphereAssociations = 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 getMarketingName(): ?string
{
return $this->marketingName;
}
public function setMarketingName(?string $marketingName): self
{
$this->marketingName = $marketingName;
return $this;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
public function getShortDescription(): ?string
{
return $this->shortDescription;
}
public function setShortDescription(?string $shortDescription): Atmosphere
{
$this->shortDescription = $shortDescription;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getComment(): ?string
{
return $this->comment;
}
public function setComment(?string $comment): self
{
$this->comment = $comment;
return $this;
}
public function getCompany(): ?Company
{
return $this->company;
}
public function setCompany(?Company $company): self
{
$this->company = $company;
return $this;
}
/**
* @return Collection<int, CabinCategory>
*/
public function getCabinCategories(): Collection
{
return $this->cabinCategories;
}
public function addCabinCategory(CabinCategory $cabinCategory): self
{
if (!$this->cabinCategories->contains($cabinCategory)) {
$this->cabinCategories[] = $cabinCategory;
$cabinCategory->setAtmosphere($this);
}
return $this;
}
public function removeCabinCategory(CabinCategory $cabinCategory): self
{
if ($this->cabinCategories->removeElement($cabinCategory)) {
// set the owning side to null (unless already changed)
if ($cabinCategory->getAtmosphere() === $this) {
$cabinCategory->setAtmosphere(null);
}
}
return $this;
}
/**
* @return Collection<int, OnBoardLife>
*/
public function getOnBoardLives(): Collection
{
return $this->onBoardLives;
}
public function addOnBoardLife(OnBoardLife $onBoardLife): self
{
if (!$this->onBoardLives->contains($onBoardLife)) {
$this->onBoardLives[] = $onBoardLife;
$onBoardLife->setAtmosphere($this);
}
return $this;
}
public function removeOnBoardLife(OnBoardLife $onBoardLife): self
{
if ($this->onBoardLives->removeElement($onBoardLife)) {
// set the owning side to null (unless already changed)
if ($onBoardLife->getAtmosphere() === $this) {
$onBoardLife->setAtmosphere(null);
}
}
return $this;
}
public function getIncluded(): ?string
{
return $this->included;
}
public function setIncluded(?string $included): self
{
$this->included = $included;
return $this;
}
public function getExcluded(): ?string
{
return $this->excluded;
}
public function setExcluded(?string $excluded): self
{
$this->excluded = $excluded;
return $this;
}
/**
* @return Collection<int, ServiceAtmosphereAssociation>
*/
public function getServiceAtmosphereAssociations(): Collection
{
return $this->serviceAtmosphereAssociations;
}
public function addServiceAtmosphereAssociation(ServiceAtmosphereAssociation $serviceAtmosphereAssociation): self
{
if (!$this->serviceAtmosphereAssociations->contains($serviceAtmosphereAssociation)) {
$this->serviceAtmosphereAssociations[] = $serviceAtmosphereAssociation;
$serviceAtmosphereAssociation->setAtmosphere($this);
}
return $this;
}
public function removeServiceAtmosphereAssociation(ServiceAtmosphereAssociation $serviceAtmosphereAssociation): self
{
if ($this->serviceAtmosphereAssociations->removeElement($serviceAtmosphereAssociation)) {
// set the owning side to null (unless already changed)
if ($serviceAtmosphereAssociation->getAtmosphere() === $this) {
$serviceAtmosphereAssociation->setAtmosphere(null);
}
}
return $this;
}
public function getInheritsServicesFrom(): ?Atmosphere
{
return $this->inheritsServicesFrom;
}
public function setInheritsServicesFrom(?Atmosphere $inheritsServicesFrom): self
{
$this->inheritsServicesFrom = $inheritsServicesFrom;
return $this;
}
public function getReassignment(): ?string
{
return $this->reassignment;
}
public function setReassignment(?string $reassignment): self
{
$this->reassignment = $reassignment;
return $this;
}
/**
* Method liée au Média Bundle
*/
public function getMediaTagOwnerLabel(): ?string
{
return $this->getName();
}
/**
* Method liée au Média Bundle
* @return class-string
*/
public function getFqcn(): string
{
return ClassUtils::getClass($this);
}
}