<?php
namespace App\Entity;
use App\Repository\ClientRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Loggable\Loggable;
use Symfony\Component\Validator\Constraints as Assert;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass=ClientRepository::class)
* @Gedmo\Loggable
*/
class Client implements Loggable
{
/**
* Hook timestampable behavior
* updates createdAt, updatedAt fields
*/
use TimestampableEntity;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
* @Assert\NotBlank
*/
// Last name:
private $name;
/**
* @ORM\Column(type="string", length=255)
* @Assert\NotBlank
* @Assert\Email()
*/
private $email;
/**
* @ORM\OneToMany(targetEntity=FenceOffer::class, mappedBy="client")
*/
private $fenceOffers;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $salutation;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $furtherSalutation;
/**
* @ORM\Column(type="string", length=255)
*/
private $firstName;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $firm;
/**
* @ORM\Column(type="integer", length=255)
*/
private $clientNumber;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $mobilePhone;
/**
* @ORM\Column(type="boolean")
*/
private $invoiceRecipient;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $landLinePhone;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $website;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $fax;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $streetAndHouseNumber;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $postalCode;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $place;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $land;
/**
* @ORM\Column(type="integer", options={"default": 1})
*/
private $nextOfferNumber = 1;
public function __construct()
{
$this->fenceOffers = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
/**
* @return Collection<int, FenceOffer>
*/
public function getFenceOffers(): Collection
{
return $this->fenceOffers;
}
public function addFenceOffer(FenceOffer $fenceOffer): self
{
if (!$this->fenceOffers->contains($fenceOffer)) {
$this->fenceOffers[] = $fenceOffer;
$fenceOffer->setClient($this);
}
return $this;
}
public function removeFenceOffer(FenceOffer $fenceOffer): self
{
if ($this->fenceOffers->removeElement($fenceOffer)) {
// set the owning side to null (unless already changed)
if ($fenceOffer->getClient() === $this) {
$fenceOffer->setClient(null);
}
}
return $this;
}
public function __toString(): string
{
return $this->name;
}
public function getSalutation(): ?string
{
return $this->salutation;
}
public function setSalutation(?string $salutation): self
{
$this->salutation = $salutation;
return $this;
}
public function getFurtherSalutation(): ?string
{
return $this->furtherSalutation;
}
public function setFurtherSalutation(?string $furtherSalutation): self
{
$this->furtherSalutation = $furtherSalutation;
return $this;
}
public function getFirstName(): ?string
{
return $this->firstName;
}
public function setFirstName(string $firstName): self
{
$this->firstName = $firstName;
return $this;
}
public function getFirm(): ?string
{
return $this->firm;
}
public function setFirm(?string $firm): self
{
$this->firm = $firm;
return $this;
}
public function getClientNumber(): ?string
{
return $this->clientNumber;
}
public function setClientNumber(string $clientNumber): self
{
$this->clientNumber = $clientNumber;
return $this;
}
public function getMobilePhone(): ?string
{
return $this->mobilePhone;
}
public function setMobilePhone(?string $mobilePhone): self
{
$this->mobilePhone = $mobilePhone;
return $this;
}
public function isInvoiceRecipient(): ?bool
{
return $this->invoiceRecipient;
}
public function setInvoiceRecipient(bool $invoiceRecipient): self
{
$this->invoiceRecipient = $invoiceRecipient;
return $this;
}
public function getLandLinePhone(): ?string
{
return $this->landLinePhone;
}
public function setLandLinePhone(?string $landLinePhone): self
{
$this->landLinePhone = $landLinePhone;
return $this;
}
public function getWebsite(): ?string
{
return $this->website;
}
public function setWebsite(?string $website): self
{
$this->website = $website;
return $this;
}
public function getFax(): ?string
{
return $this->fax;
}
public function setFax(?string $fax): self
{
$this->fax = $fax;
return $this;
}
public function getStreetAndHouseNumber(): ?string
{
return $this->streetAndHouseNumber;
}
public function setStreetAndHouseNumber(?string $streetAndHouseNumber): self
{
$this->streetAndHouseNumber = $streetAndHouseNumber;
return $this;
}
public function getPostalCode(): ?string
{
return $this->postalCode;
}
public function setPostalCode(?string $postalCode): self
{
$this->postalCode = $postalCode;
return $this;
}
public function getPlace(): ?string
{
return $this->place;
}
public function setPlace(?string $place): self
{
$this->place = $place;
return $this;
}
public function getLand(): ?string
{
return $this->land;
}
public function setLand(?string $land): self
{
$this->land = $land;
return $this;
}
public function getNextOfferNumber(): int
{
return $this->nextOfferNumber;
}
public function incrementNextOfferNumber(): void
{
$this->nextOfferNumber++;
}
}