<?php
namespace App\Entity;
use App\Constants\Typology;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* Clientes
*
* @ORM\Table(name="clients")
* @ORM\Entity(repositoryClass="App\Repository\ClientRepository")
* @ORM\HasLifecycleCallbacks()
*/
class Client
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="type", type="string", length=255)
* @Assert\NotBlank()
*/
private $type;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
* @Assert\NotBlank()
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=255, nullable=true)
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="address", type="string", length=255)
* @Assert\NotBlank()
*/
private $address;
/**
* @var string
*
* @ORM\Column(name="address_number", type="string", length=255)
* @Assert\NotBlank()
*/
private $addressNumber;
/**
* @var string
*
* @ORM\Column(name="zip_code", type="string", length=255)
* @Assert\NotBlank()
*/
private $zipCode;
/**
* @var string
*
* @ORM\Column(name="population", type="string", length=255, nullable=true)
*
*/
private $population;
/**
* @var string
*
* @ORM\Column(name="province", type="string", length=255, nullable=true)
*
*/
private $province;
/**
* @var string
*
* @ORM\Column(name="region", type="string", length=255)
* @Assert\NotBlank()
*/
private $region;
/**
* @var string
*
* @ORM\Column(name="country", type="string", length=255)
* @Assert\NotBlank()
*/
private $country;
/**
* @var string
*
* @ORM\Column(name="telephone", type="string", length=255)
* @Assert\NotBlank()
*/
private $telephone;
/**
* @var string
*
* @ORM\Column(name="fax", type="string", length=255, nullable=true)
*
*/
private $fax;
/**
* @var string
*
* @ORM\Column(name="email", type="string", length=255, nullable=true)
*/
private $email;
/**
* @var string
*
* @ORM\Column(name="gds", type="string", length=255, nullable=true)
*/
private $gds;
/**
* @var string
*
* @ORM\Column(name="type_document", type="string", length=255, nullable=true)
*/
private $typeDocument;
/**
* @var string
*
* @ORM\Column(name="id_document", type="string", length=255, nullable=true)
*/
private $idDocument;
/**
* @var string
*
* @ORM\Column(name="observation", type="text", nullable=true)
*/
private $observation;
/**
* @var \DateTime
*
* @ORM\Column(name="created_at", type="datetime")
*/
private $createdAt;
/**
* @var int
*
* @ORM\Column(name="created_id", type="integer", nullable=true)
*/
private $createdId;
/**
* @var \DateTime
*
* @ORM\Column(name="updated_at", type="datetime")
*/
private $updatedAt;
/**
* @var int
*
* @ORM\Column(name="updated_id", type="integer", nullable=true)
*/
private $updatedId;
/**
* @var int
*
* @ORM\Column(name="status", type="boolean")
*/
private $state;
/**
* @var string
*
* @ORM\Column(name="picture", type="string", length=255, nullable=true)
*/
private $picture;
/**
* @var string
*
* @ORM\Column(name="group_id", type="integer", nullable=true)
*/
private $groupId;
/**
* @var string
*
* @ORM\Column(name="competency", type="string", length=255, nullable=true)
*/
private $competency;
/**
* @var string
*
* @ORM\Column(name="action", type="string", length=255, nullable=true)
* @Assert\NotBlank()
*/
private $action;
/**
* @var string
*
* @ORM\Column(name="return_investment", type="string", length=255, nullable=true)
*/
private $returnInvestment;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $typology;
/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
private $sageCode;
/**
* @ORM\Column(type="string", length=34, nullable=true)
*/
private $iban;
/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
private $swift;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $bankName;
/**
* @ORM\Column(type="boolean")
*/
private $sentToSage;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $syncDate;
/**
* @ORM\OneToMany(targetEntity=ClientAccountingAccount::class, mappedBy="client", orphanRemoval=true)
*/
private $clientAccountingAccounts;
/**
* @ORM\OneToMany(targetEntity=DeliveryNote::class, mappedBy="client")
*/
private $deliveryNotes;
/**
* @ORM\ManyToOne(targetEntity=SagePaymentMethod::class)
*/
private $sagePaymentMethod;
/**
* @ORM\OneToMany(targetEntity=SagePayment::class, mappedBy="client")
*/
private $sagePayments;
/**
* @ORM\ManyToMany(targetEntity=SettingsCompany::class, inversedBy="clients")
*/
private $settingsCompany;
public function __construct()
{
$this->clientAccountingAccounts = new ArrayCollection();
$this->deliveryNotes = new ArrayCollection();
$this->sagePayments = new ArrayCollection();
$this->settingsCompany = new ArrayCollection();
}
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set type
*
* @param string $type
*
* @return Client
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* Get type
*
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* Set name
*
* @param string $name
*
* @return Client
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set title
*
* @param string $title
*
* @return Client
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set address
*
* @param string $address
*
* @return Client
*/
public function setAddress($address)
{
$this->address = $address;
return $this;
}
/**
* Get address
*
* @return string
*/
public function getAddress()
{
return $this->address;
}
/**
* Set addressNumber
*
* @param string $addressNumber
*
* @return Client
*/
public function setAddressNumber($addressNumber)
{
$this->addressNumber = $addressNumber;
return $this;
}
/**
* Get addressNumber
*
* @return string
*/
public function getAddressNumber()
{
return $this->addressNumber;
}
/**
* Set zipCode
*
* @param string $zipCode
*
* @return Client
*/
public function setZipCode($zipCode)
{
$this->zipCode = $zipCode;
return $this;
}
/**
* Get zipCode
*
* @return string
*/
public function getZipCode()
{
return $this->zipCode;
}
/**
* Set population
*
* @param string $population
*
* @return Client
*/
public function setPopulation($population)
{
$this->population = $population;
return $this;
}
/**
* Get population
*
* @return string
*/
public function getPopulation()
{
return $this->population;
}
/**
* Set province
*
* @param string $province
*
* @return Client
*/
public function setProvince($province)
{
$this->province = $province;
return $this;
}
/**
* Get province
*
* @return string
*/
public function getProvince()
{
return $this->province;
}
/**
* Set country
*
* @param string $country
*
* @return Client
*/
public function setCountry($country)
{
$this->country = $country;
return $this;
}
/**
* Get country
*
* @return string
*/
public function getCountry()
{
return $this->country;
}
/**
* Set telephone
*
* @param string $telephone
*
* @return Client
*/
public function setTelephone($telephone)
{
$this->telephone = $telephone;
return $this;
}
/**
* Get telephone
*
* @return string
*/
public function getTelephone()
{
return $this->telephone;
}
/**
* Set fax
*
* @param string $fax
*
* @return Client
*/
public function setFax($fax)
{
$this->fax = $fax;
return $this;
}
/**
* Get fax
*
* @return string
*/
public function getFax()
{
return $this->fax;
}
/**
* Set email
*
* @param string $email
*
* @return Client
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* Get email
*
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* Set gds
*
* @param string $gds
*
* @return Client
*/
public function setGds($gds)
{
$this->gds = $gds;
return $this;
}
/**
* Get gds
*
* @return string
*/
public function getGds()
{
return $this->gds;
}
/**
* Set idDocument
*
* @param string $idDocument
*
* @return Client
*/
public function setIdDocument($idDocument)
{
$this->idDocument = $idDocument;
return $this;
}
/**
* Get idDocument
*
* @return string
*/
public function getIdDocument()
{
return $this->idDocument;
}
/**
* Set observation
*
* @param string $observation
*
* @return Client
*/
public function setObservation($observation)
{
$this->observation = $observation;
return $this;
}
/**
* Get observation
*
* @return string
*/
public function getObservation()
{
return $this->observation;
}
/**
* Set createdAt
*
* @param \Datetime $createdAt
*
* @return Client
*/
public function setCreatedAt(\Datetime $createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return \Datetime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set createdId
*
* @param integer $createdId
*
* @return Client
*/
public function setCreatedId($createdId)
{
$this->createdId = $createdId;
return $this;
}
/**
* Get createdId
*
* @return int
*/
public function getCreatedId()
{
return $this->createdId;
}
/**
* Set updatedAt
*
* @param \Datetime $updatedAt
*
* @return Client
*/
public function setUpdatedAt(\Datetime $updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return \Datetime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* Set updatedId
*
* @param integer $updatedId
*
* @return Client
*/
public function setUpdatedId($updatedId)
{
$this->updatedId = $updatedId;
return $this;
}
/**
* Get updatedId
*
* @return int
*/
public function getUpdatedId()
{
return $this->updatedId;
}
/**
* Set state
*
* @param boolean $state
*
* @return Client
*/
public function setState($state)
{
$this->state = $state;
return $this;
}
/**
* Get state
*
* @return int
*/
public function getState()
{
return $this->state;
}
/**
* Set picture
*
* @param string $picture
*
* @return Client
*/
public function setPicture($picture)
{
$this->picture = $picture;
return $this;
}
/**
* Get picture
*
* @return string
*/
public function getPicture()
{
return $this->picture;
}
/**
* @ORM\PrePersist
*/
public function setCreatedAtValue()
{
$this->createdAt = new \Datetime();
}
/**
* @ORM\PrePersist
* @ORM\PreUpdate
*/
public function setUpdatedAtValue()
{
$this->updatedAt = new \Datetime();
}
/**
* Set groupId
*
* @param integer $groupId
*
* @return Client
*/
public function setGroupId($groupId)
{
$this->groupId = $groupId;
return $this;
}
/**
* Get groupId
*
* @return integer
*/
public function getGroupId()
{
return $this->groupId;
}
/**
* Set competency
*
* @param string $competency
*
* @return Client
*/
public function setCompetency($competency)
{
$this->competency = $competency;
return $this;
}
/**
* Get competency
*
* @return string
*/
public function getCompetency()
{
return $this->competency;
}
/**
* Set action
*
* @param string $action
*
* @return Client
*/
public function setAction($action)
{
$this->action = $action;
return $this;
}
/**
* Get action
*
* @return string
*/
public function getAction()
{
return $this->action;
}
/**
* Set typeDocument
*
* @param string $typeDocument
*
* @return Client
*/
public function setTypeDocument($typeDocument)
{
$this->typeDocument = $typeDocument;
return $this;
}
/**
* Get typeDocument
*
* @return string
*/
public function getTypeDocument()
{
return $this->typeDocument;
}
/**
* Set returnInvestment
*
* @param string $returnInvestment
*
* @return Client
*/
public function setReturnInvestment($returnInvestment)
{
$this->returnInvestment = $returnInvestment;
return $this;
}
/**
* Get returnInvestment
*
* @return string
*/
public function getReturnInvestment()
{
return $this->returnInvestment;
}
/**
* Set region
*
* @param string $region
*
* @return Client
*/
public function setRegion($region)
{
$this->region = $region;
return $this;
}
/**
* Get region
*
* @return string
*/
public function getRegion()
{
return $this->region;
}
public function getTypology(): ?string
{
return $this->typology;
}
public function setTypology(?string $typology): self
{
if (!Typology::isValid($typology) && $typology !== null) {
throw new \InvalidArgumentException("Sector inválido: $typology");
}
$this->typology = $typology;
return $this;
}
public function getSageCode(): ?string
{
return $this->sageCode;
}
public function setSageCode(string $sageCode): self
{
$this->sageCode = $sageCode;
return $this;
}
public function getIban(): ?string
{
return $this->iban;
}
public function setIban(?string $iban): self
{
$this->iban = $iban;
return $this;
}
public function getSwift(): ?string
{
return $this->swift;
}
public function setSwift(?string $swift): self
{
$this->swift = $swift;
return $this;
}
public function getBankName(): ?string
{
return $this->bankName;
}
public function setBankName(?string $bankName): self
{
$this->bankName = $bankName;
return $this;
}
public function isSentToSage(): ?bool
{
return $this->sentToSage;
}
public function setSentToSage(bool $sentToSage): self
{
$this->sentToSage = $sentToSage;
return $this;
}
public function getSyncDate(): ?\DateTimeInterface
{
return $this->syncDate;
}
public function setSyncDate(?\DateTimeInterface $syncDate): self
{
$this->syncDate = $syncDate;
return $this;
}
/**
* @return Collection<int, ClientAccountingAccount>
*/
public function getClientAccountingAccounts(): Collection
{
return $this->clientAccountingAccounts;
}
public function addClientAccountingAccount(ClientAccountingAccount $clientAccountingAccount): self
{
if (!$this->clientAccountingAccounts->contains($clientAccountingAccount)) {
$this->clientAccountingAccounts[] = $clientAccountingAccount;
$clientAccountingAccount->setClient($this);
}
return $this;
}
public function removeClientAccountingAccount(ClientAccountingAccount $clientAccountingAccount): self
{
if ($this->clientAccountingAccounts->removeElement($clientAccountingAccount)) {
// set the owning side to null (unless already changed)
if ($clientAccountingAccount->getClient() === $this) {
$clientAccountingAccount->setClient(null);
}
}
return $this;
}
/**
* @return Collection<int, DeliveryNote>
*/
public function getDeliveryNotes(): Collection
{
return $this->deliveryNotes;
}
public function addDeliveryNote(DeliveryNote $deliveryNote): self
{
if (!$this->deliveryNotes->contains($deliveryNote)) {
$this->deliveryNotes[] = $deliveryNote;
$deliveryNote->setClient($this);
}
return $this;
}
public function removeDeliveryNote(DeliveryNote $deliveryNote): self
{
if ($this->deliveryNotes->removeElement($deliveryNote)) {
// set the owning side to null (unless already changed)
if ($deliveryNote->getClient() === $this) {
$deliveryNote->setClient(null);
}
}
return $this;
}
public function getSagePaymentMethod(): ?SagePaymentMethod
{
return $this->sagePaymentMethod;
}
public function setSagePaymentMethod(?SagePaymentMethod $sagePaymentMethod): self
{
$this->sagePaymentMethod = $sagePaymentMethod;
return $this;
}
/**
* @return Collection<int, SagePayment>
*/
public function getSagePayments(): Collection
{
return $this->sagePayments;
}
public function addSagePayment(SagePayment $payment): self
{
if (!$this->sagePayments->contains($payment)) {
$this->sagePayments[] = $payment;
$payment->setClient($this);
}
return $this;
}
public function removeSagePayment(SagePayment $payment): self
{
if ($this->sagePayments->removeElement($payment)) {
// set the owning side to null (unless already changed)
if ($payment->getClient() === $this) {
$payment->setClient(null);
}
}
return $this;
}
/**
* @return Collection<int, SettingsCompany>
*/
public function getSettingsCompany(): Collection
{
return $this->settingsCompany;
}
public function addSettingsCompany(SettingsCompany $settingsCompany): self
{
if (!$this->settingsCompany->contains($settingsCompany)) {
$this->settingsCompany[] = $settingsCompany;
}
return $this;
}
public function removeSettingsCompany(SettingsCompany $settingsCompany): self
{
$this->settingsCompany->removeElement($settingsCompany);
return $this;
}
}