<?php
namespace App\Entity;
use App\Constants\BusinessTypeSettingsCompanyConstants;
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;
/**
* SettingsCompany
*
* @ORM\Table(name="settings_company")
* @ORM\Entity(repositoryClass="App\Repository\SettingsCompanyRepository")
* @ORM\HasLifecycleCallbacks()
*/
class SettingsCompany
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="company", type="string", length=255)
*/
private $company;
/**
* @var string
*
* @ORM\Column(name="id_document", type="string", length=255, nullable=true)
*/
private $idDocument;
/**
* @var string
*
* @ORM\Column(name="registry", type="string", length=255, nullable=true)
*/
private $registry;
/**
* @var string
*
* @ORM\Column(name="address", type="string", length=255, nullable=true)
*/
private $address;
/**
* @var string
*
* @ORM\Column(name="zip_code", type="string", length=255, nullable=true)
*/
private $zipCode;
/**
* @var string
*
* @ORM\Column(name="telephone", type="string", length=255, nullable=true)
*/
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="note", type="text", nullable=true)
*/
private $note;
/**
* @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 string
*
* @ORM\Column(name="picture", type="string", length=255, nullable=true)
*/
private $picture;
/**
* @var string
*
* @ORM\Column(name="token", type="string", nullable=true)
*/
private $token;
/**
* @ORM\Column(type="string", length=10, nullable=true)
*/
private $sageCompany;
/**
* @ORM\Column(type="string", length=10, nullable=true)
*/
private $sageGroup;
/**
* @ORM\OneToMany(targetEntity=DeliveryNote::class, mappedBy="sageCompany")
*/
private $deliveryNotes;
/**
* @ORM\Column(name="comision", type="decimal", precision=10, scale=2, nullable=true)
*/
private $comision;
/**
* @ORM\OneToOne(targetEntity=Supplier::class, cascade={"persist","merge"})
* @ORM\JoinColumn(nullable=true)
*/
private ?Supplier $supplier = null;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $priority;
/**
* @ORM\Column(type="string", length=50)
*/
private $businessType;
/**
* @ORM\ManyToMany(targetEntity=Client::class, mappedBy="settingsCompany")
*/
private $clients;
/**
* @ORM\ManyToMany(targetEntity=Supplier::class, mappedBy="settingsCompany")
*/
private $suppliers;
/**
* @var string
*
* @ORM\Column(name="state", type="string", length=255, nullable=true)
*/
private $state;
public function __construct()
{
$this->deliveryNotes = new ArrayCollection();
$this->clients = new ArrayCollection();
$this->suppliers = new ArrayCollection();
}
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set company
*
* @param string $company
*
* @return SettingsCompany
*/
public function setCompany($company)
{
$this->company = $company;
return $this;
}
/**
* Get company
*
* @return string
*/
public function getCompany()
{
return $this->company;
}
/**
* Set idDocument
*
* @param string $idDocument
*
* @return SettingsCompany
*/
public function setIdDocument($idDocument)
{
$this->idDocument = $idDocument;
return $this;
}
/**
* Get idDocument
*
* @return string
*/
public function getIdDocument()
{
return $this->idDocument;
}
/**
* Set registry
*
* @param string $registry
*
* @return SettingsCompany
*/
public function setRegistry($registry)
{
$this->registry = $registry;
return $this;
}
/**
* Get registry
*
* @return string
*/
public function getRegistry()
{
return $this->registry;
}
/**
* Set address
*
* @param string $address
*
* @return SettingsCompany
*/
public function setAddress($address)
{
$this->address = $address;
return $this;
}
/**
* Get address
*
* @return string
*/
public function getAddress()
{
return $this->address;
}
/**
* Set zipCode
*
* @param string $zipCode
*
* @return SettingsCompany
*/
public function setZipCode($zipCode)
{
$this->zipCode = $zipCode;
return $this;
}
/**
* Get zipCode
*
* @return string
*/
public function getZipCode()
{
return $this->zipCode;
}
/**
* Set telephone
*
* @param string $telephone
*
* @return SettingsCompany
*/
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 SettingsCompany
*/
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 SettingsCompany
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* Get email
*
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* Set note
*
* @param string $note
*
* @return SettingsCompany
*/
public function setNote($note)
{
$this->note = $note;
return $this;
}
/**
* Get note
*
* @return string
*/
public function getNote()
{
return $this->note;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
*
* @return SettingsCompany
*/
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 SettingsCompany
*/
public function setCreatedId($createdId)
{
$this->createdId = $createdId;
return $this;
}
/**
* Get createdId
*
* @return integer
*/
public function getCreatedId()
{
return $this->createdId;
}
/**
* Set updatedAt
*
* @param \DateTime $updatedAt
*
* @return SettingsCompany
*/
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 SettingsCompany
*/
public function setUpdatedId($updatedId)
{
$this->updatedId = $updatedId;
return $this;
}
/**
* Get updatedId
*
* @return integer
*/
public function getUpdatedId()
{
return $this->updatedId;
}
/**
* @ORM\PrePersist
*/
public function setCreatedAtValue()
{
$this->createdAt = new \Datetime();
}
/**
* @ORM\PrePersist
* @ORM\PreUpdate
*/
public function setUpdatedAtValue()
{
$this->updatedAt = new \Datetime();
}
/**
* Set picture
*
* @param string $picture
*
* @return SettingsCompany
*/
public function setPicture($picture)
{
$this->picture = $picture;
return $this;
}
/**
* Get picture
*
* @return string
*/
public function getPicture()
{
return $this->picture;
}
/**
* @return string
*/
public function getToken()
{
return $this->token;
}
/**
* @param string $token
*/
public function setToken($token)
{
$this->token = $token;
}
public function getSageCompany(): ?string
{
return $this->sageCompany;
}
public function setSageCompany(?string $sageCompany): self
{
$this->sageCompany = $sageCompany;
return $this;
}
public function getSageGroup(): ?string
{
return $this->sageGroup;
}
public function setSageGroup(?string $sageGroup): self
{
$this->sageGroup = $sageGroup;
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->setSageCompany($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->getSageCompany() === $this) {
$deliveryNote->setSageCompany(null);
}
}
return $this;
}
public function getBusinessType(): ?string
{
return $this->businessType;
}
public function setBusinessType(string $businessType): self
{
if (!BusinessTypeSettingsCompanyConstants::isValid($businessType)) {
throw new \InvalidArgumentException("Invalid business type");
}
$this->businessType = $businessType;
return $this;
}
public function getComision(): ?string
{
return $this->comision;
}
/** @param string|float|null $comision */
public function setComision($comision): self
{
if ($comision === null || $comision === '') {
$this->comision = null;
return $this;
}
$norm = str_replace(',', '.', (string)$comision);
$this->comision = number_format((float)$norm, 2, '.', '');
return $this;
}
public function getSupplier(): ?Supplier {
return $this->supplier;
}
public function setSupplier(?Supplier $supplier): self {
$this->supplier = $supplier; return $this;
}
/**
* @return Collection<int, Client>
*/
public function getClients(): Collection
{
return $this->clients;
}
public function addClient(Client $client): self
{
if (!$this->clients->contains($client)) {
$this->clients[] = $client;
$client->addSettingsCompany($this);
}
return $this;
}
public function removeClient(Client $client): self
{
if ($this->clients->removeElement($client)) {
$client->removeSettingsCompany($this);
}
return $this;
}
/**
* @return Collection<int, Supplier>
*/
public function getSuppliers(): Collection
{
return $this->suppliers;
}
public function addSupplier(Supplier $supplier): self
{
if (!$this->suppliers->contains($supplier)) {
$this->suppliers[] = $supplier;
$supplier->addSettingsCompany($this);
}
return $this;
}
public function removeSupplier(Supplier $supplier): self
{
if ($this->suppliers->removeElement($supplier)) {
$supplier->removeSettingsCompany($this);
}
return $this;
}
public function getPriority(): ?int
{
return $this->priority;
}
public function setPriority(?int $priority): self
{
$this->priority = $priority;
return $this;
}
public function getState(): ?string
{
return $this->state;
}
public function setState(?string $state): self
{
$this->state = $state;
return $this;
}
}