src/Entity/MagasinDeliveryFee.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\MagasinDeliveryFeeRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClassMagasinDeliveryFeeRepository::class)]
  6. #[ORM\Table(name'magasin_delivery_fee')]
  7. #[ORM\UniqueConstraint(name'uniq_mdf_magasin_region'columns: ['magasin_id''region_id'])]
  8. class MagasinDeliveryFee
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\ManyToOne(targetEntityMagasin::class, inversedBy'deliveryFees')]
  15.     #[ORM\JoinColumn(name'magasin_id'referencedColumnName'id'nullablefalseonDelete'CASCADE')]
  16.     private ?Magasin $magasin null;
  17.     #[ORM\ManyToOne(targetEntityRegion::class)]
  18.     #[ORM\JoinColumn(name'region_id'referencedColumnName'id'nullablefalseonDelete'CASCADE')]
  19.     private ?Region $region null;
  20.     #[ORM\Column(type'decimal'precision10scale2)]
  21.     private string $fee '0.00';
  22.     #[ORM\Column(name'can_deliver')]
  23.     private bool $canDeliver true;
  24.     public function getId(): ?int { return $this->id; }
  25.     public function getMagasin(): ?Magasin { return $this->magasin; }
  26.     public function setMagasin(?Magasin $magasin): self $this->magasin $magasin; return $this; }
  27.     public function getRegion(): ?Region { return $this->region; }
  28.     public function setRegion(?Region $region): self $this->region $region; return $this; }
  29.     public function getFee(): string { return $this->fee; }
  30.     public function setFee(string|float $fee): self
  31.     {
  32.         $this->fee number_format((float)$fee2'.''');
  33.         return $this;
  34.     }
  35.     public function getFeeAsFloat(): float { return (float)$this->fee; }
  36.     public function canDeliver(): bool { return $this->canDeliver; }
  37.     public function setCanDeliver(bool $canDeliver): self $this->canDeliver $canDeliver; return $this; }
  38. }