239 lines
5.2 KiB
PHP

<?php
namespace Chill\MainBundle\Entity;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
use Chill\MainBundle\Repository\LocationRepository;
use Chill\MainBundle\Validation\Constraint\PhonenumberConstraint;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Table(name="chill_main_location")
* @ORM\Entity(repositoryClass=LocationRepository::class)
*/
class Location implements TrackCreationInterface, TrackUpdateInterface
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Serializer\Groups({"read"})
*/
private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=LocationType::class)
* @ORM\JoinColumn(nullable=false)
* @Serializer\Groups({"read"})
*/
private ?LocationType $type = null;
/**
* @ORM\OneToOne(targetEntity=Address::class, cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=true)
* @Serializer\Groups({"read"})
*/
private ?Address $address = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Serializer\Groups({"read"})
*/
private ?string $name = null;
/**
* @ORM\Column(type="string", length=64, nullable=true)
* @Serializer\Groups({"read"})
* @Assert\Regex(pattern="/^([\+{1}])([0-9\s*]{4,20})$/")
* @PhonenumberConstraint(type="any")
*/
private ?string $phonenumber1 = null;
/**
* @ORM\Column(type="string", length=64, nullable=true)
* @Serializer\Groups({"read"})
* @Assert\Regex(pattern="/^([\+{1}])([0-9\s*]{4,20})$/")
* @PhonenumberConstraint(type="any")
*/
private ?string $phonenumber2 = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Serializer\Groups({"read"})
*/
private ?string $email = null;
/**
* @ORM\Column(type="boolean")
* @Serializer\Groups({"read"})
*/
private bool $availableForUsers = false;
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @Serializer\Groups({"read"})
*/
private ?User $createdBy = null;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
* @Serializer\Groups({"read"})
*/
private ?\DateTimeImmutable $createdAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @Serializer\Groups({"read"})
*/
private ?User $updatedBy = null;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
* @Serializer\Groups({"read"})
*/
private ?\DateTimeImmutable $updatedAt = null;
public function getId(): ?int
{
return $this->id;
}
public function getType(): ?LocationType
{
return $this->type;
}
public function setType(?LocationType $type): self
{
$this->type = $type;
return $this;
}
public function getAddress(): ?Address
{
return $this->address;
}
public function setAddress(Address $address): self
{
$this->address = $address;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getPhonenumber1(): ?string
{
return $this->phonenumber1;
}
public function setPhonenumber1(?string $phonenumber1): self
{
$this->phonenumber1 = $phonenumber1;
return $this;
}
public function getPhonenumber2(): ?string
{
return $this->phonenumber2;
}
public function setPhonenumber2(?string $phonenumber2): self
{
$this->phonenumber2 = $phonenumber2;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getAvailableForUsers(): ?bool
{
return $this->availableForUsers;
}
public function setAvailableForUsers(bool $availableForUsers): self
{
$this->availableForUsers = $availableForUsers;
return $this;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(?User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedBy(): ?User
{
return $this->updatedBy;
}
public function setUpdatedBy(?User $updatedBy): self
{
$this->updatedBy = $updatedBy;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
}