src/Entity/BillingPoint.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BillingPointRepository;
  4. use App\Traits\AddressTrait;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use JMS\Serializer\Annotation as Serializer;
  9. use JMS\Serializer\Annotation\Expose;
  10. use JMS\Serializer\Annotation\Groups;
  11. /**
  12.  * @ORM\Entity(repositoryClass=BillingPointRepository::class)
  13.  *
  14.  * @Serializer\ExclusionPolicy("ALL")
  15.  */
  16. class BillingPoint
  17. {
  18.     use AddressTrait;
  19.     /**
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue
  22.      * @ORM\Column(type="integer")
  23.      *
  24.      * @Expose
  25.      * @Groups({"billingpoint", "export_billingpoint_datatable"})
  26.      */
  27.     private $id;
  28.     /**
  29.      * @ORM\OneToMany(targetEntity=User::class, mappedBy="billingPoint")
  30.      *
  31.      * @Expose
  32.      * @Groups({"billingpoint"})
  33.      */
  34.     private $users;
  35.     /**
  36.      * @ORM\Column(type="string", length=16, nullable=true)
  37.      */
  38.     private $TvaNumber;
  39.     public function __construct()
  40.     {
  41.         $this->users = new ArrayCollection();
  42.     }
  43.     public function __toString()
  44.     {
  45.         return $this->getName();
  46.     }
  47.     public function getId(): ?int
  48.     {
  49.         return $this->id;
  50.     }
  51.     /**
  52.      * @return Collection<int, User>
  53.      */
  54.     public function getUsers(): Collection
  55.     {
  56.         return $this->users;
  57.     }
  58.     public function addUser(User $user): self
  59.     {
  60.         if (!$this->users->contains($user)) {
  61.             $this->users[] = $user;
  62.             $user->setBillingPoint($this);
  63.         }
  64.         return $this;
  65.     }
  66.     public function removeUser(User $user): self
  67.     {
  68.         if ($this->users->removeElement($user)) {
  69.             // set the owning side to null (unless already changed)
  70.             if ($user->getBillingPoint() === $this) {
  71.                 $user->setBillingPoint(null);
  72.             }
  73.         }
  74.         return $this;
  75.     }
  76.     public function getTvaNumber(): ?string
  77.     {
  78.         return $this->TvaNumber;
  79.     }
  80.     public function setTvaNumber(?string $TvaNumber): self
  81.     {
  82.         $this->TvaNumber $TvaNumber;
  83.         return $this;
  84.     }
  85. }