<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* User
*
* @ORM\Table(name="user")
* @ORM\Entity
*/
class User
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string|null
*
* @ORM\Column(name="last_name", type="string", length=255, nullable=true, options={"default"="NULL"})
* @Groups({"agenda-api"})
*/
private $lastName;
/**
* @var string|null
*
* @ORM\Column(name="first_name", type="string", length=255, nullable=true, options={"default"="NULL"})
* @Groups({"agenda-api"})
*/
private $firstName;
/**
* @var string|null
*
* @ORM\Column(name="address", type="string", length=255, nullable=true, options={"default"="NULL"})
*/
private $address;
/**
* @var string|null
*
* @ORM\Column(name="address2", type="string", length=255, nullable=true, options={"default"="NULL"})
*/
private $address2;
/**
* @var string|null
*
* @ORM\Column(name="zip_code", type="string", length=10, nullable=true, options={"default"="NULL"})
*/
private $zipCode;
/**
* @var string|null
*
* @ORM\Column(name="city", type="string", length=100, nullable=true, options={"default"="NULL"})
*/
private $city;
/**
* @var string|null
*
* @ORM\Column(name="country", type="string", length=100, nullable=true, options={"default"="NULL"})
*/
private $country;
/**
* @var string|null
*
* @ORM\Column(name="phone", type="string", length=30, nullable=true, options={"default"="NULL"})
* @Groups({"agenda-api"})
*/
private $phone;
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\ManyToMany(targetEntity="CustomerProfile", inversedBy="user")
* @ORM\JoinTable(name="user_has_customer_profile",
* joinColumns={
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
* },
* inverseJoinColumns={
* @ORM\JoinColumn(name="customer_profile_id", referencedColumnName="id")
* }
* )
*/
private $customerProfile = array();
/**
* @var Account|null
*
* @ORM\OneToOne(targetEntity="Account", mappedBy="user")
*/
private $account;
/**
* @var bool|null
*
* @ORM\Column(name="concours_ete_2024", type="boolean", nullable=true)
*/
private $concoursEte2024 = false;
/**
* Constructor
*/
public function __construct()
{
$this->customerProfile = new \Doctrine\Common\Collections\ArrayCollection();
$this->partner = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int $id
*/
public function setId(int $id): void
{
$this->id = $id;
}
/**
* @return string|null
*/
public function getLastName(): ?string
{
return $this->lastName;
}
/**
* @param string|null $lastName
*/
public function setLastName(?string $lastName): void
{
$this->lastName = $lastName;
}
/**
* @return string|null
*/
public function getFirstName(): ?string
{
return $this->firstName;
}
/**
* @param string|null $firstName
*/
public function setFirstName(?string $firstName): void
{
$this->firstName = $firstName;
}
/**
* @return string|null
*/
public function getAddress(): ?string
{
return $this->address;
}
/**
* @param string|null $address
*/
public function setAddress(?string $address): void
{
$this->address = $address;
}
/**
* @return string|null
*/
public function getAddress2(): ?string
{
return $this->address2;
}
/**
* @param string|null $address2
*/
public function setAddress2(?string $address2): void
{
$this->address2 = $address2;
}
/**
* @return string|null
*/
public function getZipCode(): ?string
{
return $this->zipCode;
}
/**
* @param string|null $zipCode
*/
public function setZipCode(?string $zipCode): void
{
$this->zipCode = $zipCode;
}
/**
* @return string|null
*/
public function getCity(): ?string
{
return $this->city;
}
/**
* @param string|null $city
*/
public function setCity(?string $city): void
{
$this->city = $city;
}
/**
* @return string|null
*/
public function getCountry(): ?string
{
return $this->country;
}
/**
* @param string|null $country
*/
public function setCountry(?string $country): void
{
$this->country = $country;
}
/**
* @return string|null
*/
public function getPhone(): ?string
{
return $this->phone;
}
/**
* @param string|null $phone
*/
public function setPhone(?string $phone): void
{
$this->phone = $phone;
}
/**
* @return \Doctrine\Common\Collections\Collection
*/
public function getCustomerProfile()
{
return $this->customerProfile;
}
/**
* @param \Doctrine\Common\Collections\Collection $customerProfile
*/
public function setCustomerProfile($customerProfile): void
{
$this->customerProfile = $customerProfile;
}
/**
* @return Account|null
*/
public function getAccount(): ?Account
{
return $this->account;
}
/**
* @param Account|null $account
*/
public function setAccount(?Account $account): void
{
$this->account = $account;
}
public function getConcoursEte2024(): ?bool
{
return $this->concoursEte2024;
}
public function setConcoursEte2024(?bool $concoursEte2024): void
{
$this->concoursEte2024 = $concoursEte2024;
}
public function isFirstCoaching($em): bool
{
$count = $em->getRepository(Reservation::class)->countCoachings($this);
if ($count && $count > 0) {
return false;
}
return true;
}
public function isFirstReservation(Partner $partner, $em): bool
{
$count = $em->getRepository(Reservation::class)->countReservation($partner, $this, null);
if ($count && $count > 0) {
return false;
}
return true;
}
}