129 lines
2.6 KiB
PHP
129 lines
2.6 KiB
PHP
|
|
<?php declare(strict_types=1);
|
||
|
|
/**
|
||
|
|
* This file is part of the SplendidBear Websites' projects.
|
||
|
|
*
|
||
|
|
* Copyright (c) 2026 @ www.splendidbear.org
|
||
|
|
*
|
||
|
|
* For the full copyright and license information, please view the LICENSE
|
||
|
|
* file that was distributed with this source code.
|
||
|
|
*/
|
||
|
|
|
||
|
|
namespace App\Entity;
|
||
|
|
|
||
|
|
use App\Repository\ContactMessageRepository;
|
||
|
|
use DateTimeImmutable;
|
||
|
|
use Doctrine\DBAL\Types\Types;
|
||
|
|
use Doctrine\ORM\Mapping\Column;
|
||
|
|
use Doctrine\ORM\Mapping\Entity;
|
||
|
|
use Doctrine\ORM\Mapping\GeneratedValue;
|
||
|
|
use Doctrine\ORM\Mapping\Id;
|
||
|
|
use Doctrine\ORM\Mapping\Table;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Class ContactMessage
|
||
|
|
*
|
||
|
|
* @package App\Entity
|
||
|
|
* @author Lang <https://www.splendidbear.org>
|
||
|
|
* @category Class
|
||
|
|
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
|
||
|
|
* @link www.splendidbear.org
|
||
|
|
* @since 2026. 04. 15.
|
||
|
|
*/
|
||
|
|
#[Entity(repositoryClass: ContactMessageRepository::class)]
|
||
|
|
#[Table(name: 'contact_messages')]
|
||
|
|
class ContactMessage
|
||
|
|
{
|
||
|
|
#[Id, GeneratedValue, Column]
|
||
|
|
private ?int $id = null;
|
||
|
|
|
||
|
|
#[Column]
|
||
|
|
private string $name;
|
||
|
|
|
||
|
|
#[Column]
|
||
|
|
private string $email;
|
||
|
|
|
||
|
|
#[Column(type: Types::TEXT)]
|
||
|
|
private string $content;
|
||
|
|
|
||
|
|
#[Column]
|
||
|
|
private bool $consent = false;
|
||
|
|
|
||
|
|
#[Column]
|
||
|
|
private DateTimeImmutable $createdAt;
|
||
|
|
|
||
|
|
#[Column(length: 45, nullable: true)]
|
||
|
|
private ?string $ipAddress = null;
|
||
|
|
|
||
|
|
|
||
|
|
public function __construct()
|
||
|
|
{
|
||
|
|
$this->createdAt = new DateTimeImmutable();
|
||
|
|
}
|
||
|
|
|
||
|
|
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;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getContent(): string
|
||
|
|
{
|
||
|
|
return $this->content;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function setContent(string $content): self
|
||
|
|
{
|
||
|
|
$this->content = $content;
|
||
|
|
return $this;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function isConsent(): bool
|
||
|
|
{
|
||
|
|
return $this->consent;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function setConsent(bool $consent): self
|
||
|
|
{
|
||
|
|
$this->consent = $consent;
|
||
|
|
return $this;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getCreatedAt(): DateTimeImmutable
|
||
|
|
{
|
||
|
|
return $this->createdAt;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getIpAddress(): ?string
|
||
|
|
{
|
||
|
|
return $this->ipAddress;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function setIpAddress(?string $ipAddress): self
|
||
|
|
{
|
||
|
|
$this->ipAddress = $ipAddress;
|
||
|
|
return $this;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|