<?php
namespace App\Entity\Account;
use App\Entity\User;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'user_favourites')]
#[ORM\Entity]
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\DiscriminatorColumn(name: 'type', type: 'string', length: 12)]
#[ORM\DiscriminatorMap(['profile' => FavouriteProfile::class])]
abstract class UserFavourite
{
#[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: 'favourites')]
protected User $user;
public function __construct(User $user)
{
$this->user = $user;
}
public function getId(): int
{
return $this->id;
}
public function getUser(): User
{
return $this->user;
}
}