<?php
namespace App\Entity\Account;
use App\Entity\User;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\UniqueConstraint;
#[ORM\Table(name: 'phone_reviews_added')]
#[UniqueConstraint(name: 'search_idx', columns: ['user_id', 'phone'])]
#[ORM\Entity]
class PhoneReviewAdded
{
#[ORM\Id]
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\GeneratedValue(strategy: 'AUTO')]
protected int $id;
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')]
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'phoneReviewsAdded')]
protected User $user;
#[ORM\Column(type: 'string')]
protected string $phone;
#[ORM\Column(name: 'created_at', type: 'datetimetz_immutable', options: ['default' => 'CURRENT_TIMESTAMP'])]
protected \DateTimeImmutable $createdAt;
public function __construct(User $user, string $phone)
{
$this->user = $user;
$this->phone = $phone;
$this->createdAt = new \DateTimeImmutable('now');
}
public function getId(): int
{
return $this->id;
}
public function getUser(): User
{
return $this->user;
}
public function setUser(User $user): void
{
$this->user = $user;
}
public function getPhone(): string
{
return $this->phone;
}
public function setPhone(string $phone): void
{
$this->phone = $phone;
}
public function getCreatedAt(): \DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): void
{
$this->createdAt = $createdAt;
}
}