src/Entity/Agence.php line 18

Open in your IDE?
  1. <?php /** @noinspection PhpPropertyOnlyWrittenInspection */
  2.     namespace App\Entity;
  3.     use App\Repository\AgenceRepository;
  4.     use Doctrine\Common\Collections\ArrayCollection;
  5.     use Doctrine\Common\Collections\Collection;
  6.     use Doctrine\ORM\Mapping as ORM;
  7.     use JMS\Serializer\Annotation as Serializer;
  8.     use JMS\Serializer\Annotation\Expose;
  9.     use JMS\Serializer\Annotation\Groups;
  10.     /**
  11.      * @ORM\Entity(repositoryClass=AgenceRepository::class)
  12.      *
  13.      * @Serializer\ExclusionPolicy("ALL")
  14.      */
  15.     class Agence
  16.     {
  17.         /**
  18.          * @ORM\Id
  19.          * @ORM\GeneratedValue
  20.          * @ORM\Column(type="integer")
  21.          *
  22.          * @Expose
  23.          * @Groups({
  24.          *     "default",
  25.          *     "agency_list","export_agency_datatable"
  26.          * })
  27.          */
  28.         private $id;
  29.         /**
  30.          * @ORM\Column(type="string", length=16)
  31.          *
  32.          * @Expose
  33.          * @Groups({
  34.          *     "agency_list","export_agency_datatable"
  35.          * })
  36.          */
  37.         private ?string $code;
  38.         /**
  39.          * @ORM\Column(type="string", length=255)
  40.          *
  41.          * @Expose
  42.          * @Groups({
  43.          *     "agency:name",
  44.          *     "agency_list","export_agency_datatable","user", "user_bussiness_result", "export_purchase_declaration_datatable", "export_agency_manager_commercial_datatable", "export_agency_manager_datatable", "export_commercial_installer_datatable", "export_commercial_datatable","get:read", "purchase", "export_installer_datatable",
  45.          *     "default",
  46.          *     "agency_list",
  47.          *     "export_agency_datatable","user", "user_bussiness_result", "export_purchase_declaration_datatable", "export_agency_manager_commercial_datatable",
  48.          *     "export_agency_manager_datatable", "export_commercial_installer_datatable", "export_commercial_datatable","get:read", "purchase", "export_installer_datatable"
  49.          * })
  50.          */
  51.         private ?string $name;
  52.         /**
  53.          * @ORM\Column(type="string", length=255, nullable=true)
  54.          */
  55.         private ?string $region;
  56.         /**
  57.          * @ORM\Column(type="string", length=255, nullable=true)
  58.          *
  59.          * @Expose
  60.          * @Groups({"agency_list","export_agency_datatable"})
  61.          */
  62.         private $managerLastName;
  63.         /**
  64.          * @ORM\Column(type="string", length=255, nullable=true)
  65.          *
  66.          * @Expose
  67.          * @Groups({"agency_list","export_agency_datatable"})
  68.          */
  69.         private $managerFirstName;
  70.         /**
  71.          * @ORM\Column(type="string", length=255, nullable=true)
  72.          *
  73.          * @Expose
  74.          * @Groups ({"export_agency_datatable"})
  75.          */
  76.         private $address1;
  77.         /**
  78.          * @ORM\Column(type="string", length=255, nullable=true)
  79.          *
  80.          * @Expose
  81.          * @Groups ({"export_agency_datatable"})
  82.          */
  83.         private $address2;
  84.         /**
  85.          * @ORM\Column(type="string", length=255, nullable=true)
  86.          *
  87.          * @Expose
  88.          * @Groups ({"export_agency_datatable"})
  89.          */
  90.         private $postCode;
  91.         /**
  92.          * @ORM\Column(type="string", length=255, nullable=true)
  93.          *
  94.          * @Expose
  95.          * @Groups ({"export_agency_datatable"})
  96.          */
  97.         private $city;
  98.         /**
  99.          * @ORM\Column(type="string", length=255, nullable=true)
  100.          *
  101.          * @Expose
  102.          * @Groups ({"export_agency_datatable"})
  103.          */
  104.         private $phone;
  105.         /**
  106.          * @ORM\OneToMany(targetEntity=User::class, mappedBy="agency")
  107.          */
  108.         private $users;
  109.         public function __construct()
  110.         {
  111.             $this->users = new ArrayCollection();
  112.         }
  113.         public function __toString()
  114.         {
  115.             return $this->getName();
  116.         }
  117.         public function getName(): ?string
  118.         {
  119.             return $this->name;
  120.         }
  121.         public function setNamestring $name ): self
  122.         {
  123.             $this->name $name;
  124.             return $this;
  125.         }
  126.         public function getId(): ?int
  127.         {
  128.             return $this->id;
  129.         }
  130.         public function getCode(): ?string
  131.         {
  132.             return $this->code;
  133.         }
  134.         public function setCodestring $code ): self
  135.         {
  136.             $this->code $code;
  137.             return $this;
  138.         }
  139.         public function getRegion(): ?string
  140.         {
  141.             return $this->region;
  142.         }
  143.         public function setRegionstring $region ): self
  144.         {
  145.             $this->region $region;
  146.             return $this;
  147.         }
  148.         /**
  149.          * @return mixed
  150.          */
  151.         public function getManagerLastName()
  152.         {
  153.             return $this->managerLastName;
  154.         }
  155.         /**
  156.          * @param mixed $managerLastName
  157.          *
  158.          * @return Agence
  159.          */
  160.         public function setManagerLastName$managerLastName )
  161.         {
  162.             $this->managerLastName $managerLastName;
  163.             return $this;
  164.         }
  165.         /**
  166.          * @return mixed
  167.          */
  168.         public function getManagerFirstName()
  169.         {
  170.             return $this->managerFirstName;
  171.         }
  172.         /**
  173.          * @param mixed $managerFirstName
  174.          *
  175.          * @return Agence
  176.          */
  177.         public function setManagerFirstName$managerFirstName )
  178.         {
  179.             $this->managerFirstName $managerFirstName;
  180.             return $this;
  181.         }
  182.         /**
  183.          * @return mixed
  184.          */
  185.         public function getAddress1()
  186.         {
  187.             return $this->address1;
  188.         }
  189.         /**
  190.          * @param mixed $address1
  191.          *
  192.          * @return Agence
  193.          */
  194.         public function setAddress1$address1 )
  195.         {
  196.             $this->address1 $address1;
  197.             return $this;
  198.         }
  199.         /**
  200.          * @return mixed
  201.          */
  202.         public function getAddress2()
  203.         {
  204.             return $this->address2;
  205.         }
  206.         /**
  207.          * @param mixed $address2
  208.          *
  209.          * @return Agence
  210.          */
  211.         public function setAddress2$address2 )
  212.         {
  213.             $this->address2 $address2;
  214.             return $this;
  215.         }
  216.         /**
  217.          * @return mixed
  218.          */
  219.         public function getPostCode()
  220.         {
  221.             return $this->postCode;
  222.         }
  223.         /**
  224.          * @param mixed $postCode
  225.          *
  226.          * @return Agence
  227.          */
  228.         public function setPostCode$postCode )
  229.         {
  230.             $this->postCode $postCode;
  231.             return $this;
  232.         }
  233.         /**
  234.          * @return mixed
  235.          */
  236.         public function getCity()
  237.         {
  238.             return $this->city;
  239.         }
  240.         /**
  241.          * @param mixed $city
  242.          *
  243.          * @return Agence
  244.          */
  245.         public function setCity$city )
  246.         {
  247.             $this->city $city;
  248.             return $this;
  249.         }
  250.         /**
  251.          * @return mixed
  252.          */
  253.         public function getPhone()
  254.         {
  255.             return $this->phone;
  256.         }
  257.         /**
  258.          * @param mixed $phone
  259.          *
  260.          * @return Agence
  261.          */
  262.         public function setPhone$phone )
  263.         {
  264.             $this->phone $phone;
  265.             return $this;
  266.         }
  267.         /**
  268.          * @return Collection|User[]
  269.          */
  270.         public function getUsers(): Collection
  271.         {
  272.             return $this->users;
  273.         }
  274.         public function addUserUser $user ): self
  275.         {
  276.             if ( !$this->users->contains$user ) ) {
  277.                 $this->users[] = $user;
  278.                 $user->setAgency$this );
  279.             }
  280.             return $this;
  281.         }
  282.         public function removeUserUser $user ): self
  283.         {
  284.             if ( $this->users->removeElement$user ) ) {
  285.                 // set the owning side to null (unless already changed)
  286.                 if ( $user->getAgency() === $this ) {
  287.                     $user->setAgencyNULL );
  288.                 }
  289.             }
  290.             return $this;
  291.         }
  292.     }