<?php
namespace App\Entity;
use App\Repository\TenantsRepository;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: TenantsRepository::class)]
class Tenants
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255,nullable: true)]
private ?string $tenantName = null;
#[ORM\Column(length: 255,nullable: true)]
private ?string $tenantSurname = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $tenantPhone = null;
#[ORM\Column(length: 255,nullable: true)]
private ?string $tenantIBAN = null;
#[ORM\Column(length: 255,nullable: true)]
private ?string $tenantAddress = null;
#[ORM\Column(length: 255,nullable: true)]
private ?string $tenantCity = null;
#[ORM\Column(length: 255,nullable: true)]
private ?string $tenantPostcode = null;
#[ORM\ManyToOne(inversedBy: 'tenants', cascade: ['persist'])]
#[ORM\JoinColumn(nullable: true)]
private ?PropertyList $property = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $tenantEmail = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $building_number = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $apartment_number = null;
#[ORM\OneToOne(mappedBy: 'tenant', cascade: ['persist',])]
private ?User $users = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $floor = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bloque = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $escalera = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $province = null;
#[ORM\OneToMany(mappedBy: 'tenant', targetEntity: DocsTenants::class,cascade: ['persist','remove'])]
private Collection $docsTenants;
#[ORM\ManyToOne(inversedBy: 'tenants', cascade: ['persist', 'remove'])]
private ?Bedroom $bedroom = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $rentPaid = null;
#[ORM\Column(nullable: true)]
private ?bool $status = null;
#[ORM\OneToMany(mappedBy: 'tenant', targetEntity: MonthlyPayments::class,cascade: ['persist',], )]
private Collection $monthlyPayments;
#[ORM\OneToMany(mappedBy: 'tenant', targetEntity: PaymentDoc::class, cascade: ['persist'],)]
private Collection $paymentDocs;
#[ORM\ManyToOne(inversedBy: 'tenant')]
private ?Broker $broker = null;
#[ORM\OneToMany(mappedBy: 'tenant', targetEntity: Minutes::class, cascade: ['persist','remove'],)]
private Collection $minutes;
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $createdAt = null;
#[ORM\Column(length: 20, nullable: true)]
private ?string $docIdentificacion = null;
#[ORM\OneToMany(mappedBy: 'tenant', targetEntity: RecibosTenants::class)]
private Collection $recibosTenants;
#[ORM\OneToMany(mappedBy: 'tenant', targetEntity: RecibosUtilities::class)]
private Collection $recibosUtilities;
public function __toString(): string
{
return $this->getTenantName().' '.$this->getTenantSurname();
}
public function getNombreYDni(){
return $this->getTenantName().' '.$this->getTenantSurname().' '.($this->getDocIdentificacion() ?? "");
}
public function __construct()
{
$this->docsTenants = new ArrayCollection();
//$this->bedroom=new ArrayCollection();
$this->monthlyPayments = new ArrayCollection();
$this->paymentDocs = new ArrayCollection();
$this->minutes = new ArrayCollection();
$this->recibosTenants = new ArrayCollection();
$this->recibosUtilities = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTenantName(): ?string
{
return $this->tenantName ?? "";
}
public function setTenantName(?string $tenantName): self
{
$this->tenantName = $tenantName ?? "";
return $this;
}
public function getTenantSurname(): ?string
{
return $this->tenantSurname ?? "";
}
public function setTenantSurname(?string $tenantSurname): self
{
$this->tenantSurname = $tenantSurname ?? "";
return $this;
}
public function getTenantPhone(): ?string
{
return $this->tenantPhone ?? "";
}
public function setTenantPhone(?string $tenantPhone): self
{
$this->tenantPhone = $tenantPhone ?? "";
return $this;
}
public function getTenantIBAN(): ?string
{
return $this->tenantIBAN ?? "";
}
public function setTenantIBAN(?string $tenantIBAN): self
{
$this->tenantIBAN = $tenantIBAN ?? "";
return $this;
}
public function getTenantAddress(): ?string
{
return $this->tenantAddress ?? "";
}
public function setTenantAddress(? string $tenantAddress): self
{
$this->tenantAddress = $tenantAddress ?? "";
return $this;
}
public function getTenantCity(): ?string
{
return $this->tenantCity ?? "";
}
public function setTenantCity(?string $tenantCity): self
{
$this->tenantCity = $tenantCity ?? "";
return $this;
}
public function getTenantPostcode(): ?string
{
return $this->tenantPostcode ?? "";
}
public function setTenantPostcode(?string $tenantPostcode): self
{
$this->tenantPostcode = $tenantPostcode ?? "";
return $this;
}
public function getProperty(): ?PropertyList
{
return $this->property;
}
public function setProperty(?PropertyList $property): self
{
$this->property = $property;
return $this;
}
public function getTenantEmail(): ?string
{
return $this->tenantEmail ?? "";
}
public function setTenantEmail(?string $tenantEmail): self
{
$this->tenantEmail = $tenantEmail ?? "";
return $this;
}
public function getBuildingNumber(): ?string
{
return $this->building_number ?? "";
}
public function setBuildingNumber(?string $building_number): self
{
$this->building_number = $building_number ?? "";
return $this;
}
public function getApartmentNumber(): ?string
{
return $this->apartment_number ?? "";
}
public function setApartmentNumber(?string $apartment_number): self
{
$this->apartment_number = $apartment_number ?? "";
return $this;
}
public function getUsers(): ?User
{
return $this->users;
}
public function setUsers(?User $users): self
{
// unset the owning side of the relation if necessary
if ($users === null && $this->users !== null) {
$this->users->setTenant(null);
}
// set the owning side of the relation if necessary
if ($users !== null && $users->getTenant() !== $this) {
$users->setTenant($this);
}
$this->users = $users;
return $this;
}
public function getFloor(): ?string
{
return $this->floor ?? "";
}
public function setFloor(?string $floor): self
{
$this->floor = $floor ?? "";
return $this;
}
public function getBloque(): ?string
{
return $this->bloque ?? "";
}
public function setBloque(?string $bloque): self
{
$this->bloque = $bloque ?? "";
return $this;
}
public function getEscalera(): ?string
{
return $this->escalera ?? "";
}
public function setEscalera(?string $escalera): self
{
$this->escalera = $escalera ?? "";
return $this;
}
public function getProvince(): ?string
{
return $this->province ?? "";
}
public function setProvince(?string $province): self
{
$this->province = $province ?? "";
return $this;
}
/**
* @return Collection<int, DocsTenants>
*/
public function getDocsTenants(): Collection
{
return $this->docsTenants;
}
public function addDocsTenant(DocsTenants $docsTenant): self
{
if (!$this->docsTenants->contains($docsTenant)) {
$this->docsTenants->add($docsTenant);
$docsTenant->setTenant($this);
}
return $this;
}
public function removeDocsTenant(DocsTenants $docsTenant): self
{
if ($this->docsTenants->removeElement($docsTenant)) {
// set the owning side to null (unless already changed)
if ($docsTenant->getTenant() === $this) {
$docsTenant->setTenant(null);
}
}
return $this;
}
public function getBedroom(): ?Bedroom
{
return $this->bedroom;
}
public function setBedroom(?Bedroom $bedroom): self
{
$this->bedroom = $bedroom;
return $this;
}
public function getRentPaid(): ?string
{
return $this->rentPaid ?? "";
}
public function setRentPaid(?string $rentPaid): self
{
$this->rentPaid = $rentPaid ?? "";
return $this;
}
public function isStatus(): ?bool
{
return $this->status ?? false;
}
public function setStatus(?bool $status): self
{
$this->status = $status ?? false;
return $this;
}
/**
* @return Collection<int, MonthlyPayments>
*/
public function getMonthlyPayments(): Collection
{
return $this->monthlyPayments;
}
public function addMonthlyPayment(MonthlyPayments $monthlyPayment): self
{
if (!$this->monthlyPayments->contains($monthlyPayment)) {
$this->monthlyPayments->add($monthlyPayment);
$monthlyPayment->setTenant($this);
}
return $this;
}
public function removeMonthlyPayment(MonthlyPayments $monthlyPayment): self
{
if ($this->monthlyPayments->removeElement($monthlyPayment)) {
// set the owning side to null (unless already changed)
if ($monthlyPayment->getTenant() === $this) {
$monthlyPayment->setTenant(null);
}
}
return $this;
}
/**
* @return Collection<int, PaymentDoc>
*/
public function getPaymentDocs(): Collection
{
return $this->paymentDocs;
}
public function addPaymentDoc(PaymentDoc $paymentDoc): self
{
if (!$this->paymentDocs->contains($paymentDoc)) {
$this->paymentDocs->add($paymentDoc);
$paymentDoc->setTenant($this);
}
return $this;
}
public function removePaymentDoc(PaymentDoc $paymentDoc): self
{
if ($this->paymentDocs->removeElement($paymentDoc)) {
// set the owning side to null (unless already changed)
if ($paymentDoc->getTenant() === $this) {
$paymentDoc->setTenant(null);
}
}
return $this;
}
public function getBroker(): ?Broker
{
return $this->broker;
}
public function setBroker(?Broker $broker): self
{
$this->broker = $broker;
return $this;
}
/**
* @return Collection<int, Minutes>
*/
public function getMinutes(): Collection
{
return $this->minutes;
}
public function addMinute(Minutes $minute): self
{
if (!$this->minutes->contains($minute)) {
$this->minutes->add($minute);
$minute->setTenant($this);
}
return $this;
}
public function removeMinute(Minutes $minute): self
{
if ($this->minutes->removeElement($minute)) {
// set the owning side to null (unless already changed)
if ($minute->getTenant() === $this) {
$minute->setTenant(null);
}
}
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeImmutable $createdAt): static
{
$this->createdAt = $createdAt;
return $this;
}
public function getDocIdentificacion(): ?string
{
return $this->docIdentificacion;
}
public function setDocIdentificacion(?string $docIdentificacion): static
{
$this->docIdentificacion = $docIdentificacion;
return $this;
}
/**
* @return Collection<int, RecibosTenants>
*/
public function getRecibosTenants(): Collection
{
return $this->recibosTenants;
}
public function addRecibosTenant(RecibosTenants $recibosTenant): static
{
if (!$this->recibosTenants->contains($recibosTenant)) {
$this->recibosTenants->add($recibosTenant);
$recibosTenant->setTenant($this);
}
return $this;
}
public function removeRecibosTenant(RecibosTenants $recibosTenant): static
{
if ($this->recibosTenants->removeElement($recibosTenant)) {
// set the owning side to null (unless already changed)
if ($recibosTenant->getTenant() === $this) {
$recibosTenant->setTenant(null);
}
}
return $this;
}
/**
* @return Collection<int, RecibosUtilities>
*/
public function getRecibosUtilities(): Collection
{
return $this->recibosUtilities;
}
public function addRecibosUtility(RecibosUtilities $recibosUtility): static
{
if (!$this->recibosUtilities->contains($recibosUtility)) {
$this->recibosUtilities->add($recibosUtility);
$recibosUtility->setTenant($this);
}
return $this;
}
public function removeRecibosUtility(RecibosUtilities $recibosUtility): static
{
if ($this->recibosUtilities->removeElement($recibosUtility)) {
// set the owning side to null (unless already changed)
if ($recibosUtility->getTenant() === $this) {
$recibosUtility->setTenant(null);
}
}
return $this;
}
}