src/Entity/Partner.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PartnerRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass=PartnerRepository::class)
  7.  * @ORM\AssociationOverrides({
  8.  *      @ORM\AssociationOverride(name="company", inversedBy="partners")
  9.  * })
  10.  */
  11. class Partner extends EntityBase
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255)
  21.      */
  22.     private $displayName;
  23.     /**
  24.      * @ORM\Column(type="boolean", nullable=true)
  25.      */
  26.     private $isEmployee;
  27.     /**
  28.      * @ORM\Column(type="text", nullable=true)
  29.      */
  30.     private $address;
  31.     /**
  32.      * @ORM\OneToOne(targetEntity=AppUser::class, mappedBy="partner")
  33.      */
  34.     private $userAccount;
  35.     /**
  36.      * @ORM\OneToOne(targetEntity=Employee::class, mappedBy="partner", cascade={"persist", "remove"})
  37.      */
  38.     private $employee;
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getDisplayName(): ?string
  44.     {
  45.         return $this->displayName;
  46.     }
  47.     public function setDisplayName(string $displayName): self
  48.     {
  49.         $this->displayName $displayName;
  50.         return $this;
  51.     }
  52.     public function getIsEmployee(): ?bool
  53.     {
  54.         return $this->isEmployee;
  55.     }
  56.     public function setIsEmployee(?bool $isEmployee): self
  57.     {
  58.         $this->isEmployee $isEmployee;
  59.         return $this;
  60.     }
  61.     public function getAddress(): ?string
  62.     {
  63.         return $this->address;
  64.     }
  65.     public function setAddress(?string $address): self
  66.     {
  67.         $this->address $address;
  68.         return $this;
  69.     }
  70.     public function getUserAccount(): ?AppUser
  71.     {
  72.         return $this->userAccount;
  73.     }
  74.     public function setUserAccount(?AppUser $userAccount): self
  75.     {
  76.         // unset the owning side of the relation if necessary
  77.         if ($userAccount === null && $this->userAccount !== null) {
  78.             $this->userAccount->setPartner(null);
  79.         }
  80.         // set the owning side of the relation if necessary
  81.         if ($userAccount !== null && $userAccount->getPartner() !== $this) {
  82.             $userAccount->setPartner($this);
  83.         }
  84.         $this->userAccount $userAccount;
  85.         return $this;
  86.     }
  87.     public function getEmployee(): ?Employee
  88.     {
  89.         return $this->employee;
  90.     }
  91.     public function setEmployee(Employee $employee): self
  92.     {
  93.         // set the owning side of the relation if necessary
  94.         if ($employee->getPartner() !== $this) {
  95.             $employee->setPartner($this);
  96.         }
  97.         $this->employee $employee;
  98.         return $this;
  99.     }
  100. }