src/Entity/Company.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Criteria;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. use Doctrine\Common\Collections\Collection;
  8. use App\Entity\Reglement;
  9. /**
  10.  * Company
  11.  *
  12.  * @ORM\Table(name="company")
  13.  * @ORM\Entity
  14.  */
  15. class Company
  16. {
  17.     /**
  18.      * @var int
  19.      *
  20.      * @ORM\Column(name="id", type="integer", nullable=false)
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue(strategy="IDENTITY")
  23.      */
  24.     private $id;
  25.     /**
  26.      * @var string
  27.      *
  28.      * @ORM\Column(name="name", type="string", length=255, nullable=false, options={"default" : "SILVER BEAUTÉ"})
  29.      */
  30.     private $name;
  31.     /**
  32.      * @var string|null
  33.      *
  34.      * @ORM\Column(name="tva_number", type="string", length=255, nullable=true)
  35.      */
  36.     private $tvaNumber;
  37.     /**
  38.      * @var string|null
  39.      *
  40.      * @ORM\Column(name="capital", type="string", length=255, nullable=true)
  41.      */
  42.     private $capital;
  43.     /**
  44.      * @var string|null
  45.      *
  46.      * @ORM\Column(name="siret", type="string", length=255, nullable=true)
  47.      */
  48.     private $siret;
  49.     /**
  50.      * @var string|null
  51.      *
  52.      * @ORM\Column(name="forme", type="string", length=255, nullable=true)
  53.      */
  54.     private $forme;
  55.     /**
  56.      * @var string|null
  57.      *
  58.      * @ORM\Column(name="urssaf_number", type="string", length=255, nullable=true)
  59.      */
  60.     private $urssafNumber;
  61.     /**
  62.      * @var string|null
  63.      *
  64.      * @ORM\Column(name="fiscalite_number", type="string", length=255, nullable=true)
  65.      */
  66.     private $fiscaliteNumber;
  67.     /**
  68.      * @var string|null
  69.      *
  70.      * @ORM\Column(name="ceo_name", nullable=true)
  71.      */
  72.     private $ceoName;
  73.     /**
  74.      * @var string|null
  75.      *
  76.      * @ORM\Column(name="ceo_job", nullable=true)
  77.      */
  78.     private $ceoJob;
  79.     /**
  80.      * @var bool
  81.      *
  82.      * @ORM\Column(name="status", type="boolean", nullable=false)
  83.      */
  84.     private $status;
  85.     /**
  86.      * @ORM\Column(type="string", nullable=true)
  87.      */
  88.     private $logo;
  89.     /**
  90.      *
  91.      * @ORM\Column(name="endDate", type="string", nullable=true)
  92.      */
  93.     private $endDate;
  94.     /**
  95.      *
  96.      * @ORM\Column(name="textMail", type="text", nullable=true)
  97.      */
  98.     private $textMail;
  99.     /**
  100.      *
  101.      * @ORM\Column(name="mail", type="string", nullable=true)
  102.      */
  103.     private $mail;
  104.     /**
  105.      * @var string|null
  106.      *
  107.      * @ORM\Column(name="convention", type="string", length=255, nullable=true)
  108.      */
  109.     private $convention;
  110.     /**
  111.      * @var string
  112.      *
  113.      * @ORM\Column(name="telephoneStandard", type="string", nullable=false)
  114.      */
  115.     private $telephoneStandard;
  116.     /**
  117.      * @var Address
  118.      *
  119.      * @ORM\ManyToOne(targetEntity="Address", cascade={"persist"})
  120.      * @ORM\JoinColumn(name="address_id", referencedColumnName="id")
  121.      */
  122.     private $address;
  123.     /**
  124.      * @var BankAccount ArrayCollection
  125.      * @ORM\OneToMany(targetEntity="BankAccount", mappedBy="company", cascade={"persist"})
  126.      */
  127.     protected $bankAccounts;
  128.     /**
  129.      * @var PaymentType ArrayCollection
  130.      * @ORM\OneToMany(targetEntity="PaymentType", mappedBy="company", cascade={"persist"})
  131.      */
  132.     protected $payments;
  133.     /**
  134.      * @var PaymentType ArrayCollection
  135.      * @ORM\OneToMany(targetEntity=Reglement::class, mappedBy="company", cascade={"persist"})
  136.      */
  137.     protected $reglements;
  138.     public function __construct()
  139.     {
  140.         $this->bankAccounts = new ArrayCollection();
  141.         $this->payments = new ArrayCollection();
  142.         $this->reglements = new ArrayCollection();
  143.     }
  144.     public function __toString()
  145.     {
  146.         return $this->getName();
  147.     }
  148.     public function getId(): ?int
  149.     {
  150.         return $this->id;
  151.     }
  152.     public function getName(): ?string
  153.     {
  154.         return $this->name;
  155.     }
  156.     public function setName(string $name): self
  157.     {
  158.         $this->name $name;
  159.         return $this;
  160.     }
  161.     public function getTvaNumber(): ?string
  162.     {
  163.         return $this->tvaNumber;
  164.     }
  165.     public function setTvaNumber(?string $tvaNumber): self
  166.     {
  167.         $this->tvaNumber $tvaNumber;
  168.         return $this;
  169.     }
  170.     public function getCapital(): ?string
  171.     {
  172.         return $this->capital;
  173.     }
  174.     public function setCapital(?string $capital): self
  175.     {
  176.         $this->capital $capital;
  177.         return $this;
  178.     }
  179.     public function getSiret(): ?string
  180.     {
  181.         return $this->siret;
  182.     }
  183.     public function setSiret(?string $siret): self
  184.     {
  185.         $this->siret $siret;
  186.         return $this;
  187.     }
  188.     public function getForme(): ?string
  189.     {
  190.         return $this->forme;
  191.     }
  192.     public function setForme(?string $forme): self
  193.     {
  194.         $this->forme $forme;
  195.         return $this;
  196.     }
  197.     public function getUrssafNumber(): ?string
  198.     {
  199.         return $this->urssafNumber;
  200.     }
  201.     public function setUrssafNumber(?string $urssafNumber): self
  202.     {
  203.         $this->urssafNumber $urssafNumber;
  204.         return $this;
  205.     }
  206.     public function getFiscaliteNumber(): ?string
  207.     {
  208.         return $this->fiscaliteNumber;
  209.     }
  210.     public function setFiscaliteNumber(?string $fiscaliteNumber): self
  211.     {
  212.         $this->fiscaliteNumber $fiscaliteNumber;
  213.         return $this;
  214.     }
  215.     public function getStatus(): ?bool
  216.     {
  217.         return $this->status;
  218.     }
  219.     public function setStatus(bool $status): self
  220.     {
  221.         $this->status $status;
  222.         return $this;
  223.     }
  224.     public function getConvention(): ?string
  225.     {
  226.         return $this->convention;
  227.     }
  228.     public function setConvention(?string $convention): self
  229.     {
  230.         $this->convention $convention;
  231.         return $this;
  232.     }
  233.     public function getAddress(): ?Address
  234.     {
  235.         return $this->address;
  236.     }
  237.     public function setAddress(?Address $address): self
  238.     {
  239.         $this->address $address;
  240.         return $this;
  241.     }
  242.     /**
  243.      * @return BankAccount
  244.      */
  245.     public function getBankAccounts()
  246.     {
  247.         return $this->bankAccounts;
  248.     }
  249.     /**
  250.      * @param BankAccount $bankAccounts
  251.      */
  252.     public function setBankAccounts($bankAccounts): void
  253.     {
  254.         $this->bankAccounts $bankAccounts;
  255.     }
  256.     /**
  257.      * @return string|null
  258.      */
  259.     public function getCeoName(): ?string
  260.     {
  261.         return $this->ceoName;
  262.     }
  263.     /**
  264.      * @param string|null $ceoName
  265.      */
  266.     public function setCeoName(?string $ceoName): void
  267.     {
  268.         $this->ceoName $ceoName;
  269.     }
  270.     /**
  271.      * @return string|null
  272.      */
  273.     public function getCeoJob(): ?string
  274.     {
  275.         return $this->ceoJob;
  276.     }
  277.     /**
  278.      * @param string|null $ceoJob
  279.      */
  280.     public function setCeoJob(?string $ceoJob): void
  281.     {
  282.         $this->ceoJob $ceoJob;
  283.     }
  284.     /**
  285.      * @return bool
  286.      */
  287.     public function isEndDate()
  288.     {
  289.         return $this->endDate;
  290.     }
  291.     /**
  292.      * @param $endDate
  293.      */
  294.     public function setEndDate($endDate)
  295.     {
  296.         $this->endDate $endDate;
  297.     }
  298.     /**
  299.      * @return mixed
  300.      */
  301.     public function getLogo()
  302.     {
  303.         return $this->logo;
  304.     }
  305.     /**
  306.      * @return BankAccount
  307.      */
  308.     public function getPayments()
  309.     {
  310.         return $this->payments;
  311.     }
  312.     /**
  313.      * @param BankAccount $payments
  314.      */
  315.     public function setPayments($payments): void
  316.     {
  317.         $this->payments $payments;
  318.     }
  319.     /**
  320.      * @param mixed $logo
  321.      */
  322.     public function setLogo($logo): void
  323.     {
  324.         $this->logo $logo;
  325.     }
  326.     public function getPrefix() {
  327.         $prefix 'FR';
  328.         if(strtoupper($this->name) === 'FREESIA') {
  329.             $prefix 'FR';
  330.         }
  331.         elseif(strtoupper($this->name) === 'FREESIA SERVICE') {
  332.             $prefix 'FRS';
  333.         }
  334.         elseif(strtoupper($this->name) === 'SILVER BEAUTÉ') {
  335.             $prefix 'SB';
  336.         }
  337.         return $prefix;
  338.     }
  339.     /*********/
  340.     /*  ADD */
  341.     /********/
  342.     public function addBankAccount(BankAccount $bankAccount)
  343.     {
  344.         $this->bankAccounts->add($bankAccount);
  345.         $bankAccount->setCompany($this);
  346.     }
  347.     public function addPayment(PaymentType $paymentType)
  348.     {
  349.         $this->payments->add($paymentType);
  350.         $paymentType->setCompany($this);
  351.     }
  352.     public function removePayment(PaymentType $paymentType)
  353.     {
  354.         $this->payments->remove($paymentType);
  355.     }
  356.     public function removeBankAccount(BankAccount $bankAccount)
  357.     {
  358.         $this->bankAccounts->remove($bankAccount);
  359.     }
  360.     /**
  361.      * @return PaymentType
  362.      */
  363.     public function getSepaBankAccount() {
  364.         $criteria Criteria::create()->where(Criteria::expr()->contains('name'PaymentType::NAME_SEPA));
  365.         return $this->payments->matching($criteria)->first();
  366.     }
  367.     /**
  368.      * @return PaymentType
  369.      */
  370.     public function getCBPayment() {
  371.         $criteria Criteria::create()->where(Criteria::expr()->contains('name'PaymentType::NAME_CB));
  372.         return $this->payments->matching($criteria)->first();
  373.     }
  374.     /**
  375.      * @return PaymentType
  376.      */
  377.     public function getEspecePayment() {
  378.         $criteria Criteria::create()->where(Criteria::expr()->contains('name'PaymentType::NAME_ESPECES));
  379.         return $this->payments->matching($criteria)->first();
  380.     }
  381.     /**
  382.      * @return PaymentType
  383.      */
  384.     public function getChequePayment() {
  385.         $criteria Criteria::create()->where(Criteria::expr()->contains('name'PaymentType::NAME_CHEQUE));
  386.         return $this->payments->matching($criteria)->first();
  387.     }
  388.     /**
  389.      * @return string
  390.      */
  391.     public function getTelephoneStandard(): ?string
  392.     {
  393.         return $this->telephoneStandard;
  394.     }
  395.     /**
  396.      * @param string $telephoneStandard
  397.      */
  398.     public function setTelephoneStandard(string $telephoneStandard): void
  399.     {
  400.         $this->telephoneStandard $telephoneStandard;
  401.     }
  402.     /**
  403.      * @return mixed
  404.      */
  405.     public function getTextMail()
  406.     {
  407.         return $this->textMail;
  408.     }
  409.     /**
  410.      * @param mixed $textMail
  411.      */
  412.     public function setTextMail($textMail): void
  413.     {
  414.         $this->textMail $textMail;
  415.     }
  416.     /**
  417.      * @return PaymentType
  418.      */
  419.     public function getReglements()
  420.     {
  421.         return $this->reglements;
  422.     }
  423.     /**
  424.      * @param PaymentType $reglements
  425.      */
  426.     public function setReglements($reglements): void
  427.     {
  428.         $this->reglements $reglements;
  429.     }
  430.     /**
  431.      * @return mixed
  432.      */
  433.     public function getMail()
  434.     {
  435.         return $this->mail;
  436.     }
  437.     /**
  438.      * @param mixed $mail
  439.      */
  440.     public function setMail($mail): void
  441.     {
  442.         $this->mail $mail;
  443.     }
  444. }