src/Entity/Broker.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BrokerRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. #[ORM\Entity(repositoryClassBrokerRepository::class)]
  8. class Broker
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255nullabletrue)]
  15.     private ?string $brokerName null;
  16.     #[ORM\Column(length255nullabletrue)]
  17.     private ?string $brokerSurname null;
  18.     #[ORM\Column(length255nullabletrue)]
  19.     private ?string $brokerEmail null;
  20.     #[ORM\OneToOne(mappedBy'broker'cascade: ['persist''remove'])]
  21.     private ?User $users null;
  22.     #[ORM\Column(length255nullabletrue)]
  23.     private ?string $brokerPhone null;
  24.     #[ORM\OneToMany(mappedBy'listingAgent'targetEntityPropertyList::class, cascade: ['persist''remove'])]
  25.     private Collection $propertiesListed;
  26.     #[ORM\OneToMany(mappedBy'managingAgent'targetEntityPropertyList::class, cascade: ['persist''remove'])]
  27.     private Collection $propertiesManaged;
  28.     #[ORM\OneToMany(mappedBy'sellingAgent'targetEntityPropertyList::class, cascade: ['persist''remove'])]
  29.     private Collection $propertiesSold;
  30.     #[ORM\OneToMany(mappedBy'uploadedBy'targetEntityDocuments::class, cascade: ['persist''remove'])]
  31.     private Collection $document;
  32.     #[ORM\OneToMany(mappedBy'uploadedBy'targetEntityDocsTenants::class, cascade: ['persist''remove'])]
  33.     private Collection $tenantDocument;
  34.     #[ORM\OneToMany(mappedBy'broker'targetEntityLandlords::class)]
  35.     private Collection $landlords;
  36.     #[ORM\OneToMany(mappedBy'broker'targetEntityPotentialClients::class)]
  37.     private Collection $potentialClient;
  38.     #[ORM\OneToMany(mappedBy'broker'targetEntityTenants::class)]
  39.     private Collection $tenant;
  40.     
  41.     #[ORM\ManyToOne(targetEntity:"App\Entity\Broker"inversedBy:"subordinateBrokers")]
  42.     #[ORM\JoinColumn(name:"manager_id"referencedColumnName:"id")]
  43.     private ?Broker $manager =null;
  44.     
  45.      #[ORM\OneToMany(targetEntity:"App\Entity\Broker"mappedBy:"manager")]
  46.     private $subordinateBrokers;
  47.      #[ORM\OneToMany(mappedBy'broker'targetEntityMinutes::class, cascade: ['persist','remove'])]
  48.      private Collection $minutes;
  49.     
  50.     public function __construct()
  51.     {
  52.         
  53.         $this->propertiesManaged = new ArrayCollection();
  54.         $this->propertiesListed = new ArrayCollection();
  55.         $this->propertiesSold = new ArrayCollection();
  56.         $this->document = new ArrayCollection();
  57.         $this->tenantDocument = new ArrayCollection();
  58.         $this->landlords = new ArrayCollection();
  59.         $this->potentialClient = new ArrayCollection();
  60.         $this->tenant = new ArrayCollection();
  61.         $this->minutes = new ArrayCollection();
  62.     }
  63.     public function __toString(): string
  64.     {
  65.         return $this->getBrokerName().' '.$this->getBrokerSurname().'';
  66.     }
  67.     public function getId(): ?int
  68.     {
  69.         return $this->id;
  70.     }
  71.     public function getBrokerName(): ?string
  72.     {
  73.         return $this->brokerName;
  74.     }
  75.     public function setBrokerName(?string $brokerName): self
  76.     {
  77.         $this->brokerName $brokerName;
  78.         return $this;
  79.     }
  80.     public function getBrokerSurname(): ?string
  81.     {
  82.         return $this->brokerSurname;
  83.     }
  84.     public function setBrokerSurname(?string $brokerSurname): self
  85.     {
  86.         $this->brokerSurname $brokerSurname;
  87.         return $this;
  88.     }
  89.     public function getBrokerEmail(): ?string
  90.     {
  91.         return $this->brokerEmail;
  92.     }
  93.     public function setBrokerEmail(?string $brokerEmail): self
  94.     {
  95.         $this->brokerEmail $brokerEmail;
  96.         return $this;
  97.     }
  98.     public function getUsers(): ?User
  99.     {
  100.         return $this->users;
  101.     }
  102.     public function setUsers(?User $users): self
  103.     {
  104.         // unset the owning side of the relation if necessary
  105.         if ($users === null && $this->users !== null) {
  106.             $this->users->setBroker(null);
  107.         }
  108.         // set the owning side of the relation if necessary
  109.         if ($users !== null && $users->getBroker() !== $this) {
  110.             $users->setBroker($this);
  111.         }
  112.         $this->users $users;
  113.         return $this;
  114.     }
  115.     public function getBrokerPhone(): ?string
  116.     {
  117.         return $this->brokerPhone;
  118.     }
  119.     public function setBrokerPhone(?string $brokerPhone): self
  120.     {
  121.         $this->brokerPhone $brokerPhone;
  122.         return $this;
  123.     }
  124.   ////////////////// CAPTADOR / VENDEDOR / GESTOR ////////////////////////////
  125.     /**
  126.      * @return Collection<int, PropertyList>
  127.      */
  128.     public function getPropertiesManaged(): Collection
  129.     {
  130.         return $this->propertiesManaged;
  131.     }
  132.     public function addPropertiesManaged(PropertyList $propertiesManaged): self
  133.     {
  134.         if (!$this->propertiesManaged->contains($propertiesManaged)) {
  135.             $this->propertiesManaged->add($propertiesManaged);
  136.             $propertiesManaged->setManagingAgent($this);
  137.         }
  138.         return $this;
  139.     }
  140.     public function removePropertiesManaged(PropertyList $propertiesManaged): self
  141.     {
  142.         if ($this->propertiesManaged->removeElement($propertiesManaged)) {
  143.             // set the owning side to null (unless already changed)
  144.             if ($propertiesManaged->getManagingAgent() === $this) {
  145.                 $propertiesManaged->setManagingAgent(null);
  146.             }
  147.         }
  148.         return $this;
  149.     }
  150.     /**
  151.      * @return Collection<int, PropertyList>
  152.      */
  153.     public function getPropertiesListed(): Collection
  154.     {
  155.         return $this->propertiesListed;
  156.     }
  157.     public function addPropertiesListed(PropertyList $propertiesListed): self
  158.     {
  159.         if (!$this->propertiesListed->contains($propertiesListed)) {
  160.             $this->propertiesListed->add($propertiesListed);
  161.             $propertiesListed->setListingAgent($this);
  162.         }
  163.         return $this;
  164.     }
  165.     public function removePropertiesListed(PropertyList $propertiesListed): self
  166.     {
  167.         if ($this->propertiesListed->removeElement($propertiesListed)) {
  168.             // set the owning side to null (unless already changed)
  169.             if ($propertiesListed->getListingAgent() === $this) {
  170.                 $propertiesListed->setListingAgent(null);
  171.             }
  172.         }
  173.         return $this;
  174.     }
  175.     /**
  176.      * @return Collection<int, PropertyList>
  177.      */
  178.     public function getPropertiesSold(): Collection
  179.     {
  180.         return $this->propertiesSold;
  181.     }
  182.     public function addPropertiesSold(PropertyList $propertiesSold): self
  183.     {
  184.         if (!$this->propertiesSold->contains($propertiesSold)) {
  185.             $this->propertiesSold->add($propertiesSold);
  186.             $propertiesSold->setSellingAgent($this);
  187.         }
  188.         return $this;
  189.     }
  190.     public function removePropertiesSold(PropertyList $propertiesSold): self
  191.     {
  192.         if ($this->propertiesSold->removeElement($propertiesSold)) {
  193.             // set the owning side to null (unless already changed)
  194.             if ($propertiesSold->getSellingAgent() === $this) {
  195.                 $propertiesSold->setSellingAgent(null);
  196.             }
  197.         }
  198.         return $this;
  199.     }
  200.     //////////////////////////////////////////////////////////////////////////
  201.     /**
  202.      * @return Collection<int, Documents>
  203.      */
  204.     public function getDocument(): Collection
  205.     {
  206.         return $this->document;
  207.     }
  208.     public function addDocument(Documents $document): self
  209.     {
  210.         if (!$this->document->contains($document)) {
  211.             $this->document->add($document);
  212.             $document->setUploadedBy($this);
  213.         }
  214.         return $this;
  215.     }
  216.     public function removeDocument(Documents $document): self
  217.     {
  218.         if ($this->document->removeElement($document)) {
  219.             // set the owning side to null (unless already changed)
  220.             if ($document->getUploadedBy() === $this) {
  221.                 $document->setUploadedBy(null);
  222.             }
  223.         }
  224.         return $this;
  225.     }
  226.     /**
  227.      * @return Collection<int, DocsTenants>
  228.      */
  229.     public function getTenantDocument(): Collection
  230.     {
  231.         return $this->tenantDocument;
  232.     }
  233.     public function addTenantDocument(DocsTenants $tenantDocument): self
  234.     {
  235.         if (!$this->tenantDocument->contains($tenantDocument)) {
  236.             $this->tenantDocument->add($tenantDocument);
  237.             $tenantDocument->setUploadedBy($this);
  238.         }
  239.         return $this;
  240.     }
  241.     public function removeTenantDocument(DocsTenants $tenantDocument): self
  242.     {
  243.         if ($this->tenantDocument->removeElement($tenantDocument)) {
  244.             // set the owning side to null (unless already changed)
  245.             if ($tenantDocument->getUploadedBy() === $this) {
  246.                 $tenantDocument->setUploadedBy(null);
  247.             }
  248.         }
  249.         return $this;
  250.     }
  251.     /**
  252.      * @return Collection<int, Landlords>
  253.      */
  254.     public function getLandlords(): Collection
  255.     {
  256.         return $this->landlords;
  257.     }
  258.     public function addLandlord(Landlords $landlord): self
  259.     {
  260.         if (!$this->landlords->contains($landlord)) {
  261.             $this->landlords->add($landlord);
  262.             $landlord->setBroker($this);
  263.         }
  264.         return $this;
  265.     }
  266.     public function removeLandlord(Landlords $landlord): self
  267.     {
  268.         if ($this->landlords->removeElement($landlord)) {
  269.             // set the owning side to null (unless already changed)
  270.             if ($landlord->getBroker() === $this) {
  271.                 $landlord->setBroker(null);
  272.             }
  273.         }
  274.         return $this;
  275.     }
  276.     /**
  277.      * @return Collection<int, PotentialClients>
  278.      */
  279.     public function getPotentialClient(): Collection
  280.     {
  281.         return $this->potentialClient;
  282.     }
  283.     public function addPotentialClient(PotentialClients $potentialClient): self
  284.     {
  285.         if (!$this->potentialClient->contains($potentialClient)) {
  286.             $this->potentialClient->add($potentialClient);
  287.             $potentialClient->setBroker($this);
  288.         }
  289.         return $this;
  290.     }
  291.     public function removePotentialClient(PotentialClients $potentialClient): self
  292.     {
  293.         if ($this->potentialClient->removeElement($potentialClient)) {
  294.             // set the owning side to null (unless already changed)
  295.             if ($potentialClient->getBroker() === $this) {
  296.                 $potentialClient->setBroker(null);
  297.             }
  298.         }
  299.         return $this;
  300.     }
  301.     /**
  302.      * @return Collection<int, Tenants>
  303.      */
  304.     public function getTenant(): Collection
  305.     {
  306.         return $this->tenant;
  307.     }
  308.     public function addTenant(Tenants $tenant): self
  309.     {
  310.         if (!$this->tenant->contains($tenant)) {
  311.             $this->tenant->add($tenant);
  312.             $tenant->setBroker($this);
  313.         }
  314.         return $this;
  315.     }
  316.     public function removeTenant(Tenants $tenant): self
  317.     {
  318.         if ($this->tenant->removeElement($tenant)) {
  319.             // set the owning side to null (unless already changed)
  320.             if ($tenant->getBroker() === $this) {
  321.                 $tenant->setBroker(null);
  322.             }
  323.         }
  324.         return $this;
  325.     }
  326.     public function getManager(): ?Broker
  327.     {
  328.         return $this->manager;
  329.     }
  330.     public function setManager(?Broker $manager): void
  331.     {
  332.         $this->manager $manager;
  333.         //return $this;
  334.     }
  335.     public function getSubordinateBrokers()
  336.     {
  337.         return $this->subordinateBrokers;
  338.     }
  339.     /**
  340.      * @return Collection<int, Minutes>
  341.      */
  342.     public function getMinutes(): Collection
  343.     {
  344.         return $this->minutes;
  345.     }
  346.     public function addMinute(Minutes $minute): self
  347.     {
  348.         if (!$this->minutes->contains($minute)) {
  349.             $this->minutes->add($minute);
  350.             $minute->setBroker($this);
  351.         }
  352.         return $this;
  353.     }
  354.     public function removeMinute(Minutes $minute): self
  355.     {
  356.         if ($this->minutes->removeElement($minute)) {
  357.             // set the owning side to null (unless already changed)
  358.             if ($minute->getBroker() === $this) {
  359.                 $minute->setBroker(null);
  360.             }
  361.         }
  362.         return $this;
  363.     }
  364. }