<?php /** @noinspection PhpPropertyOnlyWrittenInspection */
namespace App\Entity;
use App\Repository\AgenceRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as Serializer;
use JMS\Serializer\Annotation\Expose;
use JMS\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=AgenceRepository::class)
*
* @Serializer\ExclusionPolicy("ALL")
*/
class Agence
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*
* @Expose
* @Groups({
* "default",
* "agency_list","export_agency_datatable"
* })
*/
private $id;
/**
* @ORM\Column(type="string", length=16)
*
* @Expose
* @Groups({
* "agency_list","export_agency_datatable"
* })
*/
private ?string $code;
/**
* @ORM\Column(type="string", length=255)
*
* @Expose
* @Groups({
* "agency:name",
* "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",
* "default",
* "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"
* })
*/
private ?string $name;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $region;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Expose
* @Groups({"agency_list","export_agency_datatable"})
*/
private $managerLastName;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Expose
* @Groups({"agency_list","export_agency_datatable"})
*/
private $managerFirstName;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Expose
* @Groups ({"export_agency_datatable"})
*/
private $address1;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Expose
* @Groups ({"export_agency_datatable"})
*/
private $address2;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Expose
* @Groups ({"export_agency_datatable"})
*/
private $postCode;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Expose
* @Groups ({"export_agency_datatable"})
*/
private $city;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Expose
* @Groups ({"export_agency_datatable"})
*/
private $phone;
/**
* @ORM\OneToMany(targetEntity=User::class, mappedBy="agency")
*/
private $users;
public function __construct()
{
$this->users = new ArrayCollection();
}
public function __toString()
{
return $this->getName();
}
public function getName(): ?string
{
return $this->name;
}
public function setName( string $name ): self
{
$this->name = $name;
return $this;
}
public function getId(): ?int
{
return $this->id;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode( string $code ): self
{
$this->code = $code;
return $this;
}
public function getRegion(): ?string
{
return $this->region;
}
public function setRegion( string $region ): self
{
$this->region = $region;
return $this;
}
/**
* @return mixed
*/
public function getManagerLastName()
{
return $this->managerLastName;
}
/**
* @param mixed $managerLastName
*
* @return Agence
*/
public function setManagerLastName( $managerLastName )
{
$this->managerLastName = $managerLastName;
return $this;
}
/**
* @return mixed
*/
public function getManagerFirstName()
{
return $this->managerFirstName;
}
/**
* @param mixed $managerFirstName
*
* @return Agence
*/
public function setManagerFirstName( $managerFirstName )
{
$this->managerFirstName = $managerFirstName;
return $this;
}
/**
* @return mixed
*/
public function getAddress1()
{
return $this->address1;
}
/**
* @param mixed $address1
*
* @return Agence
*/
public function setAddress1( $address1 )
{
$this->address1 = $address1;
return $this;
}
/**
* @return mixed
*/
public function getAddress2()
{
return $this->address2;
}
/**
* @param mixed $address2
*
* @return Agence
*/
public function setAddress2( $address2 )
{
$this->address2 = $address2;
return $this;
}
/**
* @return mixed
*/
public function getPostCode()
{
return $this->postCode;
}
/**
* @param mixed $postCode
*
* @return Agence
*/
public function setPostCode( $postCode )
{
$this->postCode = $postCode;
return $this;
}
/**
* @return mixed
*/
public function getCity()
{
return $this->city;
}
/**
* @param mixed $city
*
* @return Agence
*/
public function setCity( $city )
{
$this->city = $city;
return $this;
}
/**
* @return mixed
*/
public function getPhone()
{
return $this->phone;
}
/**
* @param mixed $phone
*
* @return Agence
*/
public function setPhone( $phone )
{
$this->phone = $phone;
return $this;
}
/**
* @return Collection|User[]
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser( User $user ): self
{
if ( !$this->users->contains( $user ) ) {
$this->users[] = $user;
$user->setAgency( $this );
}
return $this;
}
public function removeUser( User $user ): self
{
if ( $this->users->removeElement( $user ) ) {
// set the owning side to null (unless already changed)
if ( $user->getAgency() === $this ) {
$user->setAgency( NULL );
}
}
return $this;
}
}