<?php
namespace App\Entity;
use App\Repository\ShippingScaleRepository;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Blameable\Traits\BlameableEntity;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: ShippingScaleRepository::class)]
class ShippingScale
{
use BlameableEntity; //Hook blameable behaviour. Updates createdBy, updatedBy fields
use TimestampableEntity; //Hook timestampable behaviour. Updates createdAt, updatedAt fields
#[ORM\Id]
#[ORM\GeneratedValue(strategy: "IDENTITY")]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'shippingScales')]
#[ORM\JoinColumn(nullable: false)]
private ?Shipping $shipping = null;
#[ORM\Column]
#[Assert\NotNull()]
#[Assert\PositiveOrZero()]
private ?float $minWeight = null;
#[ORM\Column]
#[Assert\NotNull()]
#[Assert\Positive()]
private ?float $maxWeight = null;
#[ORM\Column]
#[Assert\NotNull()]
#[Assert\PositiveOrZero()]
private ?float $cost = null;
public function getId(): ?int
{
return $this->id;
}
public function getShipping(): ?Shipping
{
return $this->shipping;
}
public function setShipping(?Shipping $shipping): self
{
$this->shipping = $shipping;
return $this;
}
public function getMinWeight(): ?float
{
return $this->minWeight;
}
public function setMinWeight(float $minWeight): self
{
$this->minWeight = $minWeight;
return $this;
}
public function getMaxWeight(): ?float
{
return $this->maxWeight;
}
public function setMaxWeight(float $maxWeight): self
{
$this->maxWeight = $maxWeight;
return $this;
}
public function getCost(): ?float
{
return $this->cost;
}
public function setCost(float $cost): self
{
$this->cost = $cost;
return $this;
}
}