src/Entity/Drivers.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DriversRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClass: DriversRepository::class)]
  8. class Drivers
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type: 'integer')]
  13.     private $id;
  14.     #[ORM\Column(type: 'string', length: 65, nullable: true)]
  15.     private $last_name;
  16.     #[ORM\Column(type: 'string', length: 65, nullable: true)]
  17.     private $first_name;
  18.     #[ORM\Column(type: 'string', length: 255, nullable: true)]
  19.     private $adr1;
  20.     #[ORM\Column(type: 'string', length: 255, nullable: true)]
  21.     private $adr2;
  22.     #[ORM\Column(type: 'string', length: 10, nullable: true)]
  23.     private $cp;
  24.     #[ORM\Column(type: 'string', length: 65, nullable: true)]
  25.     private $city;
  26.     #[ORM\Column(type: 'string', length: 45, nullable: true)]
  27.     private $tel1;
  28.     #[ORM\Column(type: 'string', length: 45, nullable: true)]
  29.     private $tel2;
  30.     #[ORM\Column(type: 'string', length: 45, nullable: true)]
  31.     private $email;
  32.     #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'drivers')]
  33.     private $user;
  34.     #[ORM\OneToMany(mappedBy: 'driver', targetEntity: User::class)]
  35.     private $users;
  36.     #[ORM\ManyToOne(targetEntity: Carriers::class, inversedBy: 'drivers')]
  37.     private $carrier;
  38.     #[ORM\ManyToOne(targetEntity: RefCountry::class)]
  39.     private $ref_country;
  40.     #[ORM\OneToMany(mappedBy: 'driver', targetEntity: Litige::class)]
  41.     private Collection $litiges;
  42.     #[ORM\OneToMany(mappedBy: 'driver', targetEntity: Settings::class)]
  43.     private Collection $settings;
  44.     #[ORM\Column(type: 'boolean', options: ['default' => false])]
  45.     private $is_archived = false;
  46.     public function __construct()
  47.     {
  48.         $this->users = new ArrayCollection();
  49.         $this->litiges = new ArrayCollection();
  50.         $this->settings = new ArrayCollection();
  51.     }
  52.     public function getId(): ?int
  53.     {
  54.         return $this->id;
  55.     }
  56.     public function getLastName(): ?string
  57.     {
  58.         return $this->last_name;
  59.     }
  60.     public function setLastName(?string $last_name): self
  61.     {
  62.         $this->last_name = $last_name;
  63.         return $this;
  64.     }
  65.     public function getFirstName(): ?string
  66.     {
  67.         return $this->first_name;
  68.     }
  69.     public function setFirstName(?string $first_name): self
  70.     {
  71.         $this->first_name = $first_name;
  72.         return $this;
  73.     }
  74.     public function getAdr1(): ?string
  75.     {
  76.         return $this->adr1;
  77.     }
  78.     public function setAdr1(?string $adr1): self
  79.     {
  80.         $this->adr1 = $adr1;
  81.         return $this;
  82.     }
  83.     public function getAdr2(): ?string
  84.     {
  85.         return $this->adr2;
  86.     }
  87.     public function setAdr2(?string $adr2): self
  88.     {
  89.         $this->adr2 = $adr2;
  90.         return $this;
  91.     }
  92.     public function getCp(): ?string
  93.     {
  94.         return $this->cp;
  95.     }
  96.     public function setCp(?string $cp): self
  97.     {
  98.         $this->cp = $cp;
  99.         return $this;
  100.     }
  101.     public function getCity(): ?string
  102.     {
  103.         return $this->city;
  104.     }
  105.     public function setCity(?string $city): self
  106.     {
  107.         $this->city = $city;
  108.         return $this;
  109.     }
  110.     public function getTel1(): ?string
  111.     {
  112.         return $this->tel1;
  113.     }
  114.     public function setTel1(?string $tel1): self
  115.     {
  116.         $this->tel1 = $tel1;
  117.         return $this;
  118.     }
  119.     public function getTel2(): ?string
  120.     {
  121.         return $this->tel2;
  122.     }
  123.     public function setTel2(?string $tel2): self
  124.     {
  125.         $this->tel2 = $tel2;
  126.         return $this;
  127.     }
  128.     public function getEmail(): ?string
  129.     {
  130.         return $this->email;
  131.     }
  132.     public function setEmail(?string $email): self
  133.     {
  134.         $this->email = $email;
  135.         return $this;
  136.     }
  137.     public function getUser(): ?User
  138.     {
  139.         return $this->user;
  140.     }
  141.     public function setUser(?User $user): self
  142.     {
  143.         $this->user = $user;
  144.         return $this;
  145.     }
  146.     /**
  147.      * @return Collection<int, User>
  148.      */
  149.     public function getUsers(): Collection
  150.     {
  151.         return $this->users;
  152.     }
  153.     public function addUser(User $user): self
  154.     {
  155.         if (!$this->users->contains($user)) {
  156.             $this->users[] = $user;
  157.             $user->setDriver($this);
  158.         }
  159.         return $this;
  160.     }
  161.     public function removeUser(User $user): self
  162.     {
  163.         if ($this->users->removeElement($user)) {
  164.             // set the owning side to null (unless already changed)
  165.             if ($user->getDriver() === $this) {
  166.                 $user->setDriver(null);
  167.             }
  168.         }
  169.         return $this;
  170.     }
  171.     public function getCarrier(): ?Carriers
  172.     {
  173.         return $this->carrier;
  174.     }
  175.     public function setCarrier(?Carriers $carrier): self
  176.     {
  177.         $this->carrier = $carrier;
  178.         return $this;
  179.     }
  180.     public function getRefCountry(): ?RefCountry
  181.     {
  182.         return $this->ref_country;
  183.     }
  184.     public function setRefCountry(?RefCountry $ref_country): self
  185.     {
  186.         $this->ref_country = $ref_country;
  187.         return $this;
  188.     }
  189.     /**
  190.      * @return Collection<int, Litige>
  191.      */
  192.     public function getLitiges(): Collection
  193.     {
  194.         return $this->litiges;
  195.     }
  196.     public function addLitige(Litige $litige): static
  197.     {
  198.         if (!$this->litiges->contains($litige)) {
  199.             $this->litiges->add($litige);
  200.             $litige->setDriver($this);
  201.         }
  202.         return $this;
  203.     }
  204.     public function removeLitige(Litige $litige): static
  205.     {
  206.         if ($this->litiges->removeElement($litige)) {
  207.             // set the owning side to null (unless already changed)
  208.             if ($litige->getDriver() === $this) {
  209.                 $litige->setDriver(null);
  210.             }
  211.         }
  212.         return $this;
  213.     }
  214.     /**
  215.      * @return Collection<int, Settings>
  216.      */
  217.     public function getSettings(): Collection
  218.     {
  219.         return $this->settings;
  220.     }
  221.     public function addSetting(Settings $setting): static
  222.     {
  223.         if (!$this->settings->contains($setting)) {
  224.             $this->settings->add($setting);
  225.             $setting->setDriver($this);
  226.         }
  227.         return $this;
  228.     }
  229.     public function removeSetting(Settings $setting): static
  230.     {
  231.         if ($this->settings->removeElement($setting)) {
  232.             // set the owning side to null (unless already changed)
  233.             if ($setting->getDriver() === $this) {
  234.                 $setting->setDriver(null);
  235.             }
  236.         }
  237.         return $this;
  238.     }
  239.     public function getIsArchived(): ?bool
  240.     {
  241.         return $this->is_archived;
  242.     }
  243.     public function setIsArchived(bool $is_archived): self
  244.     {
  245.         $this->is_archived = $is_archived;
  246.         return $this;
  247.     }
  248. }