src/Entity/FournisseursCompany.php line 17

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: fmartin
  5.  * Date: 07/08/18
  6.  * Time: 15:43
  7.  */
  8. namespace App\Entity;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11.  * @ORM\Entity
  12.  * @ORM\Table(name="tfournisseurs_company")
  13.  */
  14. class FournisseursCompany
  15. {
  16.     /**
  17.      * @ORM\Column(type="integer")
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue(strategy="AUTO")
  20.      */
  21.     protected $id;
  22.     /**
  23.      * has one Fournisseur
  24.      *
  25.      * @ORM\ManyToOne(targetEntity="App\Entity\Fournisseurs",cascade={"persist"}, inversedBy="fournisseursCompanys")
  26.      * @ORM\JoinColumn(name="id_fournisseur", referencedColumnName="id")
  27.      */
  28.     protected $fournisseur;
  29.     /**
  30.      * has one Company
  31.      *
  32.      * @ORM\ManyToOne(targetEntity="App\Entity\Company")
  33.      * @ORM\JoinColumn(name="id_company", referencedColumnName="id")
  34.      */
  35.     protected $company;
  36.     /**
  37.      * @ORM\Column(name="no_compte", type="string", length=255, nullable=true)
  38.      */
  39.     protected $noCompte;
  40.     /**
  41.      * @return int
  42.      */
  43.     public function getId()
  44.     {
  45.         return $this->id;
  46.     }
  47.     /**
  48.      * @param int $id
  49.      */
  50.     public function setId($id)
  51.     {
  52.         $this->id $id;
  53.     }
  54.     /**
  55.      * @return Fournisseurs
  56.      */
  57.     public function getFournisseur()
  58.     {
  59.         return $this->fournisseur;
  60.     }
  61.     /**
  62.      * @param Fournisseurs $fournisseur
  63.      */
  64.     public function setFournisseur($fournisseur)
  65.     {
  66.         $this->fournisseur $fournisseur;
  67.     }
  68.     /**
  69.      * @return Company
  70.      */
  71.     public function getCompany()
  72.     {
  73.         return $this->company;
  74.     }
  75.     /**
  76.      * @param Company $company
  77.      */
  78.     public function setCompany($company)
  79.     {
  80.         $this->company $company;
  81.     }
  82.     /**
  83.      * @return string
  84.      */
  85.     public function getNoCompte()
  86.     {
  87.         $accountNumber $this->noCompte;
  88.         if (empty($accountNumber)) {
  89.             return $accountNumber;
  90.         }
  91.         if (false === strpos($accountNumber'.')) {
  92.             $accountNumber .= '.00';
  93.         }
  94.         $accountsParts explode('.'$accountNumber);
  95.         if (!empty($accountsParts[0])) {
  96.             return $accountsParts[0];
  97.         }
  98.         return $this->noCompte;
  99.     }
  100.     /**
  101.      * @param string $noCompte
  102.      */
  103.     public function setNoCompte($noCompte)
  104.     {
  105.         $this->noCompte $noCompte;
  106.     }
  107.     public function getSuccursaleNumber() {
  108.         $accountNumber $this->noCompte;
  109.         if (false === strpos($accountNumber'.')) {
  110.             $accountNumber .= '.00';
  111.         }
  112.         $accountsParts explode('.'$accountNumber);
  113.         if (!isset($accountsParts[1])) {
  114.             return 00;
  115.         }
  116.         return $accountsParts[1];
  117.     }
  118.     public function getCompanyNumber() {
  119.         $accountNumber $this->noCompte;
  120.         if (false === strpos($accountNumber'.')) {
  121.             $accountNumber .= '.00';
  122.         }
  123.         $accountsParts explode('.'$accountNumber);
  124.         return $accountsParts[0];
  125.     }
  126. }