src/Flexy/Apps/TransportBundle/Entity/MissionExtraFeesType.php line 13

  1. <?php
  2. namespace App\Flexy\Apps\TransportBundle\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\Flexy\TransportBundle\Entity\MissionExtraFeesTypeRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassMissionExtraFeesTypeRepository::class)]
  9. #[ApiResource]
  10. class MissionExtraFeesType
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length255)]
  17.     private ?string $name null;
  18.     #[ORM\Column]
  19.     private ?float $price null;
  20.     #[ORM\OneToMany(mappedBy'missionExtraFeesType'targetEntityMissionExtraFees::class)]
  21.     private Collection $missionExtraFees;
  22.     public function __construct()
  23.     {
  24.         $this->missionExtraFees = new ArrayCollection();
  25.     }
  26.     public function __toString()
  27.     {
  28.         return $this->name." : ".$this->price." EUR";
  29.     }
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getName(): ?string
  35.     {
  36.         return $this->name;
  37.     }
  38.     public function setName(string $name): self
  39.     {
  40.         $this->name $name;
  41.         return $this;
  42.     }
  43.     public function getPrice(): ?float
  44.     {
  45.         return $this->price;
  46.     }
  47.     public function setPrice(float $price): self
  48.     {
  49.         $this->price $price;
  50.         return $this;
  51.     }
  52.     /**
  53.      * @return Collection<int, MissionExtraFees>
  54.      */
  55.     public function getMissionExtraFees(): Collection
  56.     {
  57.         return $this->missionExtraFees;
  58.     }
  59.     public function addMissionExtraFee(MissionExtraFees $missionExtraFee): self
  60.     {
  61.         if (!$this->missionExtraFees->contains($missionExtraFee)) {
  62.             $this->missionExtraFees->add($missionExtraFee);
  63.             $missionExtraFee->setMissionExtraFeesType($this);
  64.         }
  65.         return $this;
  66.     }
  67.     public function removeMissionExtraFee(MissionExtraFees $missionExtraFee): self
  68.     {
  69.         if ($this->missionExtraFees->removeElement($missionExtraFee)) {
  70.             // set the owning side to null (unless already changed)
  71.             if ($missionExtraFee->getMissionExtraFeesType() === $this) {
  72.                 $missionExtraFee->setMissionExtraFeesType(null);
  73.             }
  74.         }
  75.         return $this;
  76.     }
  77. }