<?php
declare(strict_types=1);
namespace App\Models;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Class Contact.
*/
class Contact
{
/**
* @var string|null
* @Assert\NotBlank
* @Assert\Length(min="2", max="50")
*/
private $name;
/**
* @var string|null
* @Assert\NotBlank
* @Assert\Length(min="2", max="50")
*/
private $lastname;
/**
* @var string|null
* @Assert\NotBlank
* @Assert\Email
* @Assert\Length(min="10", max="78")
*/
private $email;
/**
* @var string|null
* @Assert\Length(max="30")
*/
private $phone;
/**
* @var string|null
* @Assert\NotBlank
* @Assert\Length(min="2", max="300")
*/
private $message;
/**
* @var bool
*/
private $acknowledgmentReceipt;
public function __construct()
{
$this->acknowledgmentReceipt = false;
}
public function getName(): ?string
{
return $this->name;
}
/**
* @return Contact
*/
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getLastname(): ?string
{
return $this->lastname;
}
/**
* @return Contact
*/
public function setLastname(?string $lastname): self
{
$this->lastname = $lastname;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
/**
* @return Contact
*/
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
/**
* @return Contact
*/
public function setPhone(?string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getMessage(): ?string
{
return $this->message;
}
/**
* @return Contact
*/
public function setMessage(?string $message): self
{
$this->message = $message;
return $this;
}
public function isAcknowledgmentReceipt(): bool
{
return $this->acknowledgmentReceipt;
}
/**
* @return Contact
*/
public function setAcknowledgmentReceipt(bool $acknowledgmentReceipt): self
{
$this->acknowledgmentReceipt = $acknowledgmentReceipt;
return $this;
}
public function toArray(): array
{
return [
"name" => $this->getName(),
"lastName" => $this->getLastname(),
"email" => $this->getEmail(),
"phone" => $this->getPhone(),
"message" => $this->getMessage(),
"acknowledgmentReceipt" => $this->isAcknowledgmentReceipt(),
];
}
}