<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* Shelving
*
* @ORM\Table(name="shelving", indexes={@ORM\Index(name="FKshelving199755", columns={"storage_id"})})
* @ORM\Entity()
*/
class Shelving
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255, nullable=false)
*/
private $name;
/**
* @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 float
*
* @ORM\Column(name="maximum_weight", type="float", precision=10, scale=0, nullable=false)
*/
private $maximumWeight;
/**
* @var Storage
*
* @ORM\ManyToOne(targetEntity="Storage")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="storage_id", referencedColumnName="id")
* })
*/
private $storage;
/**
* @ORM\OneToMany(targetEntity=Level::class, mappedBy="shelving")
*/
private $levels;
public function __construct()
{
$this->levels = 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 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 getMaximumWeight(): ?float
{
return $this->maximumWeight;
}
public function setMaximumWeight(float $maximumWeight): self
{
$this->maximumWeight = $maximumWeight;
return $this;
}
public function getStorage(): ?Storage
{
return $this->storage;
}
public function setStorage(?Storage $storage): self
{
$this->storage = $storage;
return $this;
}
public function __toString()
{
return $this->storage->getName() . '-' . $this->name;
}
/**
* @return Collection<int, Level>
*/
public function getLevels(): Collection
{
return $this->levels;
}
public function addLevel(Level $level): self
{
if (!$this->levels->contains($level)) {
$this->levels[] = $level;
$level->setShelving($this);
}
return $this;
}
public function removeLevel(Level $level): self
{
if ($this->levels->removeElement($level)) {
// set the owning side to null (unless already changed)
if ($level->getShelving() === $this) {
$level->setShelving(null);
}
}
return $this;
}
}