<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* Level
*
* @ORM\Table(name="level", indexes={@ORM\Index(name="FKlevel770453", columns={"shelving_id"})})
* @ORM\Entity()
*/
class Level
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="number", type="string", length=255, nullable=false)
*/
private $number;
/**
* @var float
*
* @ORM\Column(name="length", type="float", precision=10, scale=0, nullable=false)
*/
private $length;
/**
* @var float
*
* @ORM\Column(name="width", type="float", precision=10, scale=0, nullable=false)
*/
private $width;
/**
* @var float
*
* @ORM\Column(name="height", type="float", precision=10, scale=0, nullable=false)
*/
private $height;
/**
* @var Shelving
*
* @ORM\ManyToOne(targetEntity="Shelving")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="shelving_id", referencedColumnName="id")
* })
*/
private $shelving;
/**
* @ORM\OneToMany(targetEntity=Cell::class, mappedBy="level")
*/
private $cells;
public function __construct()
{
$this->cells = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNumber(): ?string
{
return $this->number;
}
public function setNumber(string $number): self
{
$this->number = $number;
return $this;
}
public function getLength(): ?float
{
return $this->length;
}
public function setLength(float $length): self
{
$this->length = $length;
return $this;
}
public function getWidth(): ?float
{
return $this->width;
}
public function setWidth(float $width): self
{
$this->width = $width;
return $this;
}
public function getHeight(): ?float
{
return $this->height;
}
public function setHeight(float $height): self
{
$this->height = $height;
return $this;
}
public function getShelving(): ?Shelving
{
return $this->shelving;
}
public function setShelving(?Shelving $shelving): self
{
$this->shelving = $shelving;
return $this;
}
public function __toString()
{
return $this->shelving->getStorage()->getName() . '-' . $this->shelving->getName() . '-' . $this->number;
}
/**
* @return Collection<int, Cell>
*/
public function getCells(): Collection
{
return $this->cells;
}
public function addCell(Cell $cell): self
{
if (!$this->cells->contains($cell)) {
$this->cells[] = $cell;
$cell->setLevel($this);
}
return $this;
}
public function removeCell(Cell $cell): self
{
if ($this->cells->removeElement($cell)) {
// set the owning side to null (unless already changed)
if ($cell->getLevel() === $this) {
$cell->setLevel(null);
}
}
return $this;
}
}