src/Flexy/ShopBundle/Entity/Shipping/ShippingCalculationMethod.php line 11

  1. <?php
  2. namespace App\Flexy\ShopBundle\Entity\Shipping;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\Flexy\ShopBundle\Entity\Shipping\ShippingCalculationMethodRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassShippingCalculationMethodRepository::class)]
  7. #[ApiResource]
  8. class ShippingCalculationMethod
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     
  15.     
  16.     /**
  17.      *
  18.      * @example [distance|weight|volume|dimension]
  19.      */
  20.     #[ORM\Column(length255)]
  21.     private ?string $type null;
  22.     /**
  23.      *
  24.      * @example The default price for the type selected
  25.      */
  26.     #[ORM\Column]
  27.     private ?float $price null;
  28.     #[ORM\ManyToOne(inversedBy'calculationMethods')]
  29.     private ?ShippingMethod $shippingMethod null;
  30.     public function __toString()
  31.     {
  32.         return "Type : ".ucfirst((string)$this->type);
  33.     }
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     public function getType(): ?string
  39.     {
  40.         return $this->type;
  41.     }
  42.     public function setType(string $type): self
  43.     {
  44.         $this->type $type;
  45.         return $this;
  46.     }
  47.     public function getPrice(): ?float
  48.     {
  49.         return $this->price;
  50.     }
  51.     public function setPrice(float $price): self
  52.     {
  53.         $this->price $price;
  54.         return $this;
  55.     }
  56.     public function getShippingMethod(): ?ShippingMethod
  57.     {
  58.         return $this->shippingMethod;
  59.     }
  60.     public function setShippingMethod(?ShippingMethod $shippingMethod): self
  61.     {
  62.         $this->shippingMethod $shippingMethod;
  63.         return $this;
  64.     }
  65. }