src/Entity/Master/CompanyMailer.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Master;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Table(name="eposm_m_company_mailer")
  9.  * @ORM\Entity
  10.  */
  11. class CompanyMailer
  12. {
  13.     function getDisplaySuppliers(){
  14.         $string "";
  15.         $first true;
  16.         foreach($this->suppliers as $sup){
  17.             if($first$first false; else $string.=", ";
  18.             $string.= $sup->getName();
  19.         }
  20.         return $string;
  21.     }
  22.     /**
  23.      * @ORM\Column(name="id", type="bigint")
  24.      * @ORM\Id
  25.      * @ORM\GeneratedValue(strategy="AUTO")
  26.      */
  27.     protected $id;
  28.         
  29.     /**
  30.      * @ORM\Column(name="nickname", type="string", length=191, nullable=true)
  31.      */
  32.     protected $nickname;
  33.         
  34.     /**
  35.      * @ORM\Column(name="user", type="string", length=191, nullable=true)
  36.      */
  37.     protected $user;
  38.     
  39.     /**
  40.      * @ORM\Column(name="password", type="string", length=191, nullable=true)
  41.      */
  42.     protected $password;
  43.     // ManyToOne
  44.         /**
  45.          * @ORM\ManyToOne(targetEntity="App\Entity\Master\Company", inversedBy="mailers")
  46.          * @ORM\JoinColumn(name="company_id", referencedColumnName="id")
  47.          */
  48.         private $company;
  49.     //
  50.     
  51.     // ManyToMany
  52.         /**
  53.          * @ORM\ManyToMany(targetEntity="App\Entity\Master\Supplier", mappedBy="mailers")
  54.          */
  55.         private $suppliers;
  56.         public function __construct()
  57.         {
  58.             $this->suppliers = new ArrayCollection();
  59.         }
  60.     //
  61.     public function getId(): ?string
  62.     {
  63.         return $this->id;
  64.     }
  65.     public function getNickname(): ?string
  66.     {
  67.         return $this->nickname;
  68.     }
  69.     public function setNickname(?string $nickname): static
  70.     {
  71.         $this->nickname $nickname;
  72.         return $this;
  73.     }
  74.     public function getUser(): ?string
  75.     {
  76.         return $this->user;
  77.     }
  78.     public function setUser(?string $user): static
  79.     {
  80.         $this->user $user;
  81.         return $this;
  82.     }
  83.     public function getPassword(): ?string
  84.     {
  85.         return $this->password;
  86.     }
  87.     public function setPassword(?string $password): static
  88.     {
  89.         $this->password $password;
  90.         return $this;
  91.     }
  92.     public function getCompany(): ?Company
  93.     {
  94.         return $this->company;
  95.     }
  96.     public function setCompany(?Company $company): static
  97.     {
  98.         $this->company $company;
  99.         return $this;
  100.     }
  101.     /**
  102.      * @return Collection<int, Supplier>
  103.      */
  104.     public function getSuppliers(): Collection
  105.     {
  106.         return $this->suppliers;
  107.     }
  108.     public function addSupplier(Supplier $supplier): static
  109.     {
  110.         if (!$this->suppliers->contains($supplier)) {
  111.             $this->suppliers->add($supplier);
  112.             $supplier->addMailer($this);
  113.         }
  114.         return $this;
  115.     }
  116.     public function removeSupplier(Supplier $supplier): static
  117.     {
  118.         if ($this->suppliers->removeElement($supplier)) {
  119.             $supplier->removeMailer($this);
  120.         }
  121.         return $this;
  122.     }
  123. }