<?php
namespace App\Entity;
use App\Repository\CustomerRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CustomerRepository::class)
*/
class Customer
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private ?int $id;
/**
* @ORM\Column(type="string", length=255)
*/
private ?string $name = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $phone = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $principalContact = null;
/**
* @ORM\Column(type="integer")
*/
private ?int $priority = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $town = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $postalCode = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $address = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $address2 = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $activitySector = null;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $picture = null;
/**
* @ORM\Column(type="boolean")
*/
private ?bool $enable = null;
/**
* @ORM\ManyToOne(targetEntity=Contact::class)
* @ORM\JoinColumn(nullable=true)
*/
private ?Contact $contactPrincipal;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $siret;
/**
* @ORM\Column(type="datetime")
*/
private \DateTime $createdAt;
/**
* @ORM\OneToMany(targetEntity=Ticket::class, mappedBy="customer")
*/
private Collection $tickets;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $numberPoste = null;
/**
* @ORM\OneToMany(targetEntity=Contact::class, mappedBy="customer")
*/
private $contacts;
public function __construct()
{
$this->setPriority(0); // default value
$this->setEnable(1); // default value
$this->createdAt = new \DateTime(" 00:00:00");
$this->tickets = new ArrayCollection();
$this->contacts = 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 getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getPrincipalContact(): ?string
{
return $this->principalContact;
}
public function setPrincipalContact(?string $principalContact): self
{
$this->principalContact = $principalContact;
return $this;
}
public function getPriority(): ?int
{
return $this->priority;
}
public function setPriority(int $priority): self
{
$this->priority = $priority;
return $this;
}
public function getTown(): ?string
{
return $this->town;
}
public function setTown(?string $town): self
{
$this->town = $town;
return $this;
}
public function getPostalCode(): ?string
{
return $this->postalCode;
}
public function setPostalCode(?string $postalCode): self
{
$this->postalCode = $postalCode;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): self
{
$this->address = $address;
return $this;
}
public function getAddress2(): ?string
{
return $this->address2;
}
public function setAddress2(?string $address2): self
{
$this->address2 = $address2;
return $this;
}
public function getActivitySector(): ?string
{
return $this->activitySector;
}
public function setActivitySector(?string $activitySector): self
{
$this->activitySector = $activitySector;
return $this;
}
public function getPicture(): ?string
{
return $this->picture;
}
public function setPicture(?string $picture): self
{
$this->picture = $picture;
return $this;
}
public function getEnable(): ?bool
{
return $this->enable;
}
public function setEnable(bool $enable): self
{
$this->enable = $enable;
return $this;
}
public function getSiret(): ?string
{
return $this->siret;
}
public function setSiret(?string $siret): self
{
$this->siret = $siret;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getNumberPoste(): ?string
{
return $this->numberPoste;
}
public function setNumberPoste(?string $numberPoste): self
{
$this->numberPoste = $numberPoste;
return $this;
}
public function getContactPrincipal(): ?Contact
{
return $this->contactPrincipal;
}
public function setContactPrincipal(?Contact $contactPrincipal): self
{
$this->contactPrincipal = $contactPrincipal;
return $this;
}
/**
* @return Collection|Ticket[]
*/
public function getTickets(): Collection
{
return $this->tickets;
}
public function addTicket(Ticket $ticket): self
{
if (!$this->tickets->contains($ticket)) {
$this->tickets[] = $ticket;
$ticket->setCustomer($this);
}
return $this;
}
public function removeTicket(Ticket $ticket): self
{
if ($this->tickets->removeElement($ticket)) {
// set the owning side to null (unless already changed)
if ($ticket->getCustomer() === $this) {
$ticket->setCustomer(null);
}
}
return $this;
}
/**
* @return Collection|Contact[]
*/
public function getContacts(): Collection
{
return $this->contacts;
}
public function addContact(Contact $contact): self
{
if (!$this->contacts->contains($contact)) {
$this->contacts[] = $contact;
$contact->setCustomers($this);
}
return $this;
}
public function removeContact(Contact $contact): self
{
if ($this->contacts->removeElement($contact)) {
// set the owning side to null (unless already changed)
if ($contact->getCustomers() === $this) {
$contact->setCustomers(null);
}
}
return $this;
}
}