refactor(core) : point user relations to the shared contract via resolve_target_entities

This commit is contained in:
Matthieu
2026-06-19 16:04:14 +02:00
parent f8fc4d6bd9
commit d70925b812
7 changed files with 44 additions and 37 deletions
+5 -4
View File
@@ -10,6 +10,7 @@ use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Patch;
use App\Enum\AbsenceType;
use App\Repository\AbsenceBalanceRepository;
use App\Shared\Domain\Contract\UserInterface;
use App\State\AbsenceBalanceProvider;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
@@ -45,10 +46,10 @@ class AbsenceBalance
#[Groups(['absence_balance:read'])]
private ?int $id = null;
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\ManyToOne(targetEntity: UserInterface::class)]
#[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
#[Groups(['absence_balance:read'])]
private ?User $user = null;
private ?UserInterface $user = null;
#[ORM\Column(type: Types::STRING, length: 32, enumType: AbsenceType::class)]
#[Groups(['absence_balance:read'])]
@@ -110,12 +111,12 @@ class AbsenceBalance
return $this->id;
}
public function getUser(): ?User
public function getUser(): ?UserInterface
{
return $this->user;
}
public function setUser(?User $user): static
public function setUser(?UserInterface $user): static
{
$this->user = $user;