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.         public function getId(): ?string
  61.         {
  62.             return $this->id;
  63.         }
  64.         public function getNickname(): ?string
  65.         {
  66.             return $this->nickname;
  67.         }
  68.         public function setNickname(?string $nickname): static
  69.         {
  70.             $this->nickname $nickname;
  71.             return $this;
  72.         }
  73.         public function getUser(): ?string
  74.         {
  75.             return $this->user;
  76.         }
  77.         public function setUser(?string $user): static
  78.         {
  79.             $this->user $user;
  80.             return $this;
  81.         }
  82.         public function getPassword(): ?string
  83.         {
  84.             return $this->password;
  85.         }
  86.         public function setPassword(?string $password): static
  87.         {
  88.             $this->password $password;
  89.             return $this;
  90.         }
  91.         public function getCompany(): ?Company
  92.         {
  93.             return $this->company;
  94.         }
  95.         public function setCompany(?Company $company): static
  96.         {
  97.             $this->company $company;
  98.             return $this;
  99.         }
  100.         /**
  101.          * @return Collection<int, Supplier>
  102.          */
  103.         public function getSuppliers(): Collection
  104.         {
  105.             return $this->suppliers;
  106.         }
  107.         public function addSupplier(Supplier $supplier): static
  108.         {
  109.             if (!$this->suppliers->contains($supplier)) {
  110.                 $this->suppliers->add($supplier);
  111.                 $supplier->addMailer($this);
  112.             }
  113.             return $this;
  114.         }
  115.         public function removeSupplier(Supplier $supplier): static
  116.         {
  117.             if ($this->suppliers->removeElement($supplier)) {
  118.                 $supplier->removeMailer($this);
  119.             }
  120.             return $this;
  121.         }
  122. }