src/Entity/SettingsCompany.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Constants\BusinessTypeSettingsCompanyConstants;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. /**
  10.  * SettingsCompany
  11.  *
  12.  * @ORM\Table(name="settings_company")
  13.  * @ORM\Entity(repositoryClass="App\Repository\SettingsCompanyRepository")
  14.  * @ORM\HasLifecycleCallbacks()
  15.  */
  16. class SettingsCompany
  17. {
  18.     /**
  19.      * @var int
  20.      *
  21.      * @ORM\Column(name="id", type="integer")
  22.      * @ORM\Id
  23.      * @ORM\GeneratedValue(strategy="AUTO")
  24.      */
  25.     private $id;
  26.     /**
  27.      * @var string
  28.      *
  29.      * @ORM\Column(name="company", type="string", length=255)
  30.      */
  31.     private $company;
  32.     /**
  33.      * @var string
  34.      *
  35.      * @ORM\Column(name="id_document", type="string", length=255, nullable=true)
  36.      */
  37.     private $idDocument;
  38.     /**
  39.      * @var string
  40.      *
  41.      * @ORM\Column(name="registry", type="string", length=255, nullable=true)
  42.      */
  43.     private $registry;
  44.     /**
  45.      * @var string
  46.      *
  47.      * @ORM\Column(name="address", type="string", length=255, nullable=true)
  48.      */
  49.     private $address;
  50.     /**
  51.      * @var string
  52.      *
  53.      * @ORM\Column(name="zip_code", type="string", length=255, nullable=true)
  54.      */
  55.     private $zipCode;
  56.     /**
  57.      * @var string
  58.      *
  59.      * @ORM\Column(name="telephone", type="string", length=255, nullable=true)
  60.      */
  61.     private $telephone;
  62.     /**
  63.      * @var string
  64.      *
  65.      * @ORM\Column(name="fax", type="string", length=255, nullable=true)
  66.      */
  67.     private $fax;
  68.     /**
  69.      * @var string
  70.      *
  71.      * @ORM\Column(name="email", type="string", length=255, nullable=true)
  72.      */
  73.     private $email;
  74.     /**
  75.      * @var string
  76.      *
  77.      * @ORM\Column(name="note", type="text", nullable=true)
  78.      */
  79.     private $note;
  80.     /**
  81.      * @var \DateTime
  82.      *
  83.      * @ORM\Column(name="created_at", type="datetime")
  84.      */
  85.     private $createdAt;
  86.     /**
  87.      * @var int
  88.      *
  89.      * @ORM\Column(name="created_id", type="integer", nullable=true)
  90.      */
  91.     private $createdId;
  92.     /**
  93.      * @var \DateTime
  94.      *
  95.      * @ORM\Column(name="updated_at", type="datetime")
  96.      */
  97.     private $updatedAt;
  98.     /**
  99.      * @var int
  100.      *
  101.      * @ORM\Column(name="updated_id", type="integer", nullable=true)
  102.      */
  103.     private $updatedId;
  104.     /**
  105.      * @var string
  106.      *
  107.      * @ORM\Column(name="picture", type="string", length=255, nullable=true)
  108.      */
  109.     private $picture;
  110.     /**
  111.      * @var string
  112.      *
  113.      * @ORM\Column(name="token", type="string", nullable=true)
  114.      */
  115.     private $token;
  116.     /**
  117.      * @ORM\Column(type="string", length=10, nullable=true)
  118.      */
  119.     private $sageCompany;
  120.     /**
  121.      * @ORM\Column(type="string", length=10, nullable=true)
  122.      */
  123.     private $sageGroup;
  124.     /**
  125.      * @ORM\OneToMany(targetEntity=DeliveryNote::class, mappedBy="sageCompany")
  126.      */
  127.     private $deliveryNotes;
  128.     /**
  129.      * @ORM\Column(name="comision", type="decimal", precision=10, scale=2, nullable=true)
  130.      */
  131.     private $comision;
  132.     /**
  133.      * @ORM\OneToOne(targetEntity=Supplier::class, cascade={"persist","merge"})
  134.      * @ORM\JoinColumn(nullable=true)
  135.      */
  136.     private ?Supplier $supplier null;
  137.     /**
  138.      * @ORM\Column(type="integer", nullable=true)
  139.      */
  140.     private $priority;
  141.     /**
  142.      * @ORM\Column(type="string", length=50)
  143.      */
  144.     private $businessType;
  145.     /**
  146.      * @ORM\ManyToMany(targetEntity=Client::class, mappedBy="settingsCompany")
  147.      */
  148.     private $clients;
  149.     /**
  150.      * @ORM\ManyToMany(targetEntity=Supplier::class, mappedBy="settingsCompany")
  151.      */
  152.     private $suppliers;
  153.     /**
  154.      * @var string
  155.      *
  156.      * @ORM\Column(name="state", type="string", length=255, nullable=true)
  157.      */
  158.     private $state;
  159.     public function __construct()
  160.     {
  161.         $this->deliveryNotes = new ArrayCollection();
  162.         $this->clients = new ArrayCollection();
  163.         $this->suppliers = new ArrayCollection();
  164.     }
  165.     /**
  166.      * Get id
  167.      *
  168.      * @return int
  169.      */
  170.     public function getId()
  171.     {
  172.         return $this->id;
  173.     }
  174.     /**
  175.      * Set company
  176.      *
  177.      * @param string $company
  178.      *
  179.      * @return SettingsCompany
  180.      */
  181.     public function setCompany($company)
  182.     {
  183.         $this->company $company;
  184.         return $this;
  185.     }
  186.     /**
  187.      * Get company
  188.      *
  189.      * @return string
  190.      */
  191.     public function getCompany()
  192.     {
  193.         return $this->company;
  194.     }
  195.     /**
  196.      * Set idDocument
  197.      *
  198.      * @param string $idDocument
  199.      *
  200.      * @return SettingsCompany
  201.      */
  202.     public function setIdDocument($idDocument)
  203.     {
  204.         $this->idDocument $idDocument;
  205.         return $this;
  206.     }
  207.     /**
  208.      * Get idDocument
  209.      *
  210.      * @return string
  211.      */
  212.     public function getIdDocument()
  213.     {
  214.         return $this->idDocument;
  215.     }
  216.     /**
  217.      * Set registry
  218.      *
  219.      * @param string $registry
  220.      *
  221.      * @return SettingsCompany
  222.      */
  223.     public function setRegistry($registry)
  224.     {
  225.         $this->registry $registry;
  226.         return $this;
  227.     }
  228.     /**
  229.      * Get registry
  230.      *
  231.      * @return string
  232.      */
  233.     public function getRegistry()
  234.     {
  235.         return $this->registry;
  236.     }
  237.     /**
  238.      * Set address
  239.      *
  240.      * @param string $address
  241.      *
  242.      * @return SettingsCompany
  243.      */
  244.     public function setAddress($address)
  245.     {
  246.         $this->address $address;
  247.         return $this;
  248.     }
  249.     /**
  250.      * Get address
  251.      *
  252.      * @return string
  253.      */
  254.     public function getAddress()
  255.     {
  256.         return $this->address;
  257.     }
  258.     /**
  259.      * Set zipCode
  260.      *
  261.      * @param string $zipCode
  262.      *
  263.      * @return SettingsCompany
  264.      */
  265.     public function setZipCode($zipCode)
  266.     {
  267.         $this->zipCode $zipCode;
  268.         return $this;
  269.     }
  270.     /**
  271.      * Get zipCode
  272.      *
  273.      * @return string
  274.      */
  275.     public function getZipCode()
  276.     {
  277.         return $this->zipCode;
  278.     }
  279.     /**
  280.      * Set telephone
  281.      *
  282.      * @param string $telephone
  283.      *
  284.      * @return SettingsCompany
  285.      */
  286.     public function setTelephone($telephone)
  287.     {
  288.         $this->telephone $telephone;
  289.         return $this;
  290.     }
  291.     /**
  292.      * Get telephone
  293.      *
  294.      * @return string
  295.      */
  296.     public function getTelephone()
  297.     {
  298.         return $this->telephone;
  299.     }
  300.     /**
  301.      * Set fax
  302.      *
  303.      * @param string $fax
  304.      *
  305.      * @return SettingsCompany
  306.      */
  307.     public function setFax($fax)
  308.     {
  309.         $this->fax $fax;
  310.         return $this;
  311.     }
  312.     /**
  313.      * Get fax
  314.      *
  315.      * @return string
  316.      */
  317.     public function getFax()
  318.     {
  319.         return $this->fax;
  320.     }
  321.     /**
  322.      * Set email
  323.      *
  324.      * @param string $email
  325.      *
  326.      * @return SettingsCompany
  327.      */
  328.     public function setEmail($email)
  329.     {
  330.         $this->email $email;
  331.         return $this;
  332.     }
  333.     /**
  334.      * Get email
  335.      *
  336.      * @return string
  337.      */
  338.     public function getEmail()
  339.     {
  340.         return $this->email;
  341.     }
  342.     /**
  343.      * Set note
  344.      *
  345.      * @param string $note
  346.      *
  347.      * @return SettingsCompany
  348.      */
  349.     public function setNote($note)
  350.     {
  351.         $this->note $note;
  352.         return $this;
  353.     }
  354.     /**
  355.      * Get note
  356.      *
  357.      * @return string
  358.      */
  359.     public function getNote()
  360.     {
  361.         return $this->note;
  362.     }
  363.     /**
  364.      * Set createdAt
  365.      *
  366.      * @param \DateTime $createdAt
  367.      *
  368.      * @return SettingsCompany
  369.      */
  370.     public function setCreatedAt(\Datetime $createdAt)
  371.     {
  372.         $this->createdAt $createdAt;
  373.         return $this;
  374.     }
  375.     /**
  376.      * Get createdAt
  377.      *
  378.      * @return \DateTime
  379.      */
  380.     public function getCreatedAt()
  381.     {
  382.         return $this->createdAt;
  383.     }
  384.     /**
  385.      * Set createdId
  386.      *
  387.      * @param integer $createdId
  388.      *
  389.      * @return SettingsCompany
  390.      */
  391.     public function setCreatedId($createdId)
  392.     {
  393.         $this->createdId $createdId;
  394.         return $this;
  395.     }
  396.     /**
  397.      * Get createdId
  398.      *
  399.      * @return integer
  400.      */
  401.     public function getCreatedId()
  402.     {
  403.         return $this->createdId;
  404.     }
  405.     /**
  406.      * Set updatedAt
  407.      *
  408.      * @param \DateTime $updatedAt
  409.      *
  410.      * @return SettingsCompany
  411.      */
  412.     public function setUpdatedAt(\Datetime $updatedAt)
  413.     {
  414.         $this->updatedAt $updatedAt;
  415.         return $this;
  416.     }
  417.     /**
  418.      * Get updatedAt
  419.      *
  420.      * @return \DateTime
  421.      */
  422.     public function getUpdatedAt()
  423.     {
  424.         return $this->updatedAt;
  425.     }
  426.     /**
  427.      * Set updatedId
  428.      *
  429.      * @param integer $updatedId
  430.      *
  431.      * @return SettingsCompany
  432.      */
  433.     public function setUpdatedId($updatedId)
  434.     {
  435.         $this->updatedId $updatedId;
  436.         return $this;
  437.     }
  438.     /**
  439.      * Get updatedId
  440.      *
  441.      * @return integer
  442.      */
  443.     public function getUpdatedId()
  444.     {
  445.         return $this->updatedId;
  446.     }
  447.     /**
  448.      * @ORM\PrePersist
  449.      */
  450.     public function setCreatedAtValue()
  451.     {
  452.         $this->createdAt = new \Datetime();
  453.     }
  454.     /**
  455.      * @ORM\PrePersist
  456.      * @ORM\PreUpdate
  457.      */
  458.     public function setUpdatedAtValue()
  459.     {
  460.         $this->updatedAt = new \Datetime();
  461.     }
  462.     /**
  463.      * Set picture
  464.      *
  465.      * @param string $picture
  466.      *
  467.      * @return SettingsCompany
  468.      */
  469.     public function setPicture($picture)
  470.     {
  471.         $this->picture $picture;
  472.         return $this;
  473.     }
  474.     /**
  475.      * Get picture
  476.      *
  477.      * @return string
  478.      */
  479.     public function getPicture()
  480.     {
  481.         return $this->picture;
  482.     }
  483.     /**
  484.      * @return string
  485.      */
  486.     public function getToken()
  487.     {
  488.         return $this->token;
  489.     }
  490.     /**
  491.      * @param string $token
  492.      */
  493.     public function setToken($token)
  494.     {
  495.         $this->token $token;
  496.     }
  497.     public function getSageCompany(): ?string
  498.     {
  499.         return $this->sageCompany;
  500.     }
  501.     public function setSageCompany(?string $sageCompany): self
  502.     {
  503.         $this->sageCompany $sageCompany;
  504.         return $this;
  505.     }
  506.     public function getSageGroup(): ?string
  507.     {
  508.         return $this->sageGroup;
  509.     }
  510.     public function setSageGroup(?string $sageGroup): self
  511.     {
  512.         $this->sageGroup $sageGroup;
  513.         return $this;
  514.     }
  515.     /**
  516.      * @return Collection<int, DeliveryNote>
  517.      */
  518.     public function getDeliveryNotes(): Collection
  519.     {
  520.         return $this->deliveryNotes;
  521.     }
  522.     public function addDeliveryNote(DeliveryNote $deliveryNote): self
  523.     {
  524.         if (!$this->deliveryNotes->contains($deliveryNote)) {
  525.             $this->deliveryNotes[] = $deliveryNote;
  526.             $deliveryNote->setSageCompany($this);
  527.         }
  528.         return $this;
  529.     }
  530.     public function removeDeliveryNote(DeliveryNote $deliveryNote): self
  531.     {
  532.         if ($this->deliveryNotes->removeElement($deliveryNote)) {
  533.             // set the owning side to null (unless already changed)
  534.             if ($deliveryNote->getSageCompany() === $this) {
  535.                 $deliveryNote->setSageCompany(null);
  536.             }
  537.         }
  538.         return $this;
  539.     }
  540.     public function getBusinessType(): ?string
  541.     {
  542.         return $this->businessType;
  543.     }
  544.     public function setBusinessType(string $businessType): self
  545.     {
  546.         if (!BusinessTypeSettingsCompanyConstants::isValid($businessType)) {
  547.             throw new \InvalidArgumentException("Invalid business type");
  548.         }
  549.         $this->businessType $businessType;
  550.         return $this;
  551.     }
  552.     public function getComision(): ?string
  553.     {
  554.         return $this->comision;
  555.     }
  556.     /** @param string|float|null $comision */
  557.     public function setComision($comision): self
  558.     {
  559.         if ($comision === null || $comision === '') {
  560.             $this->comision null;
  561.             return $this;
  562.         }
  563.         $norm str_replace(',''.', (string)$comision);
  564.         $this->comision number_format((float)$norm2'.''');
  565.         return $this;
  566.     }
  567.     public function getSupplier(): ?Supplier {
  568.         return $this->supplier;
  569.     }
  570.     public function setSupplier(?Supplier $supplier): self {
  571.         $this->supplier $supplier; return $this;
  572.     }
  573.     /**
  574.      * @return Collection<int, Client>
  575.      */
  576.     public function getClients(): Collection
  577.     {
  578.         return $this->clients;
  579.     }
  580.     public function addClient(Client $client): self
  581.     {
  582.         if (!$this->clients->contains($client)) {
  583.             $this->clients[] = $client;
  584.             $client->addSettingsCompany($this);
  585.         }
  586.         return $this;
  587.     }
  588.     public function removeClient(Client $client): self
  589.     {
  590.         if ($this->clients->removeElement($client)) {
  591.             $client->removeSettingsCompany($this);
  592.         }
  593.         return $this;
  594.     }
  595.     /**
  596.      * @return Collection<int, Supplier>
  597.      */
  598.     public function getSuppliers(): Collection
  599.     {
  600.         return $this->suppliers;
  601.     }
  602.     public function addSupplier(Supplier $supplier): self
  603.     {
  604.         if (!$this->suppliers->contains($supplier)) {
  605.             $this->suppliers[] = $supplier;
  606.             $supplier->addSettingsCompany($this);
  607.         }
  608.         return $this;
  609.     }
  610.     public function removeSupplier(Supplier $supplier): self
  611.     {
  612.         if ($this->suppliers->removeElement($supplier)) {
  613.             $supplier->removeSettingsCompany($this);
  614.         }
  615.         return $this;
  616.     }
  617.     public function getPriority(): ?int
  618.     {
  619.         return $this->priority;
  620.     }
  621.     public function setPriority(?int $priority): self
  622.     {
  623.         $this->priority $priority;
  624.         return $this;
  625.     }
  626.     public function getState(): ?string
  627.     {
  628.         return $this->state;
  629.     }
  630.     public function setState(?string $state): self
  631.     {
  632.         $this->state $state;
  633.         return $this;
  634.     }
  635. }