src/Entity/Company.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CompanyRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=CompanyRepository::class)
  9.  * @ORM\AssociationOverrides({
  10.  *      @ORM\AssociationOverride(name="company",
  11.  *          joinColumns=@ORM\JoinColumn(name="parent_company_id",nullable=true))
  12.  * })
  13.  */
  14. class Company extends EntityBase
  15. {
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      */
  25.     private $code;
  26.     /**
  27.      * @ORM\Column(type="boolean")
  28.      */
  29.     private $State;
  30.     /**
  31.      * @ORM\OneToMany(targetEntity=AppUser::class, mappedBy="Company")
  32.      */
  33.     private $appUsers;
  34.     /**
  35.      * @ORM\OneToMany(targetEntity=Partner::class, mappedBy="company")
  36.      */
  37.     private $partners;
  38.     /**
  39.      * @ORM\OneToMany(targetEntity=UserRole::class, mappedBy="company")
  40.      */
  41.     private $userRoles;
  42.     /**
  43.      * @ORM\OneToMany(targetEntity=RoleAction::class, mappedBy="company")
  44.      */
  45.     private $roleActions;
  46.     /**
  47.      * @ORM\OneToMany(targetEntity=AppActions::class, mappedBy="company")
  48.      */
  49.     private $appActions;
  50.     public function __construct()
  51.     {
  52.         $this->appUsers = new ArrayCollection();
  53.         $this->partners = new ArrayCollection();
  54.          $this->userRoles = new ArrayCollection();
  55.         $this->roleActions = new ArrayCollection();
  56.         $this->appActions = new ArrayCollection();
  57.     }
  58.     public function getId(): ?int
  59.     {
  60.         return $this->id;
  61.     }
  62.     public function getCode(): ?string
  63.     {
  64.         return $this->code;
  65.     }
  66.     public function setCode(string $code): self
  67.     {
  68.         $this->code $code;
  69.         return $this;
  70.     }
  71.     public function getState(): ?bool
  72.     {
  73.         return $this->State;
  74.     }
  75.     public function setState(bool $State): self
  76.     {
  77.         $this->State $State;
  78.         return $this;
  79.     }
  80.     /**
  81.      * @return Collection|AppUser[]
  82.      */
  83.     public function getAppUsers(): Collection
  84.     {
  85.         return $this->appUsers;
  86.     }
  87.     public function addAppUser(AppUser $appUser): self
  88.     {
  89.         if (!$this->appUsers->contains($appUser)) {
  90.             $this->appUsers[] = $appUser;
  91.             $appUser->setCompany($this);
  92.         }
  93.         return $this;
  94.     }
  95.     public function removeAppUser(AppUser $appUser): self
  96.     {
  97.         if ($this->appUsers->removeElement($appUser)) {
  98.             // set the owning side to null (unless already changed)
  99.             if ($appUser->getCompany() === $this) {
  100.                 $appUser->setCompany(null);
  101.             }
  102.         }
  103.         return $this;
  104.     }
  105.     /**
  106.      * @return Collection|UserRole[]
  107.      */
  108.     public function getUserRoles(): Collection
  109.     {
  110.         return $this->userRoles;
  111.     }
  112.     public function addUserRole(UserRole $userRole): self
  113.     {
  114.         if (!$this->userRoles->contains($userRole)) {
  115.             $this->userRoles[] = $userRole;
  116.             $userRole->setCompany($this);
  117.         }
  118.         return $this;
  119.     }
  120.     public function removeUserRole(UserRole $userRole): self
  121.     {
  122.         if ($this->userRoles->removeElement($userRole)) {
  123.             // set the owning side to null (unless already changed)
  124.             if ($userRole->getCompany() === $this) {
  125.                 $userRole->setCompany(null);
  126.             }
  127.         }
  128.         return $this;
  129.     }
  130.     /**
  131.      * @return Collection|RoleAction[]
  132.      */
  133.     public function getRoleActions(): Collection
  134.     {
  135.         return $this->roleActions;
  136.     }
  137.     public function addRoleAction(RoleAction $roleAction): self
  138.     {
  139.         if (!$this->roleActions->contains($roleAction)) {
  140.             $this->roleActions[] = $roleAction;
  141.             $roleAction->setCompany($this);
  142.         }
  143.         return $this;
  144.     }
  145.     public function removeRoleAction(RoleAction $roleAction): self
  146.     {
  147.         if ($this->roleActions->removeElement($roleAction)) {
  148.             // set the owning side to null (unless already changed)
  149.             if ($roleAction->getCompany() === $this) {
  150.                 $roleAction->setCompany(null);
  151.             }
  152.         }
  153.         return $this;
  154.     }
  155.     /**
  156.      * @return Collection|AppActions[]
  157.      */
  158.     public function getAppActions(): Collection
  159.     {
  160.         return $this->appActions;
  161.     }
  162.     public function addAppAction(AppActions $appAction): self
  163.     {
  164.         if (!$this->appActions->contains($appAction)) {
  165.             $this->appActions[] = $appAction;
  166.             $appAction->setCompany($this);
  167.         }
  168.         return $this;
  169.     }
  170.     public function removeAppAction(AppActions $appAction): self
  171.     {
  172.         if ($this->appActions->removeElement($appAction)) {
  173.             // set the owning side to null (unless already changed)
  174.             if ($appAction->getCompany() === $this) {
  175.                 $appAction->setCompany(null);
  176.             }
  177.         }
  178.         return $this;
  179.     }
  180. }