|
@@ -27,6 +27,10 @@ class Sector
|
|
|
#[ORM\OneToMany(targetEntity: System::class, mappedBy: 'sector', orphanRemoval: true)]
|
|
#[ORM\OneToMany(targetEntity: System::class, mappedBy: 'sector', orphanRemoval: true)]
|
|
|
private Collection $systems;
|
|
private Collection $systems;
|
|
|
|
|
|
|
|
|
|
+ #[ORM\ManyToOne(targetEntity: Galaxy::class, inversedBy: 'sectors')]
|
|
|
|
|
+ #[ORM\JoinColumn(nullable: true)]
|
|
|
|
|
+ private ?Galaxy $galaxy = null;
|
|
|
|
|
+
|
|
|
#[ORM\Column(length: 24, enumType: SectorStatusEnum::class, options: ['default' => SectorStatusEnum::UNEXPLORED])]
|
|
#[ORM\Column(length: 24, enumType: SectorStatusEnum::class, options: ['default' => SectorStatusEnum::UNEXPLORED])]
|
|
|
private SectorStatusEnum $status = SectorStatusEnum::UNEXPLORED;
|
|
private SectorStatusEnum $status = SectorStatusEnum::UNEXPLORED;
|
|
|
|
|
|
|
@@ -68,6 +72,39 @@ class Sector
|
|
|
return $this;
|
|
return $this;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function addSystem(System $system): self
|
|
|
|
|
+ {
|
|
|
|
|
+ if (!$this->systems->contains($system)) {
|
|
|
|
|
+ $this->systems->add($system);
|
|
|
|
|
+ $system->setSector($this);
|
|
|
|
|
+ }
|
|
|
|
|
+ return $this;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function removeSystem(System $system): self
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->systems->removeElement($system)) {
|
|
|
|
|
+ if ($system->getSector() === $this) {
|
|
|
|
|
+ $system->setSector(null);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return $this;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function getGalaxy(): ?Galaxy
|
|
|
|
|
+ {
|
|
|
|
|
+ return $this->galaxy;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function setGalaxy(?Galaxy $galaxy): self
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->galaxy = $galaxy;
|
|
|
|
|
+ if ($galaxy && !$galaxy->getSectors()->contains($this)) {
|
|
|
|
|
+ $galaxy->addSector($this);
|
|
|
|
|
+ }
|
|
|
|
|
+ return $this;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public function getStatus(): SectorStatusEnum
|
|
public function getStatus(): SectorStatusEnum
|
|
|
{
|
|
{
|
|
|
return $this->status;
|
|
return $this->status;
|