refactor(core) : point user relations to the shared contract via resolve_target_entities
This commit is contained in:
@@ -14,6 +14,7 @@ use ApiPlatform\Metadata\GetCollection;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use App\Repository\TimeEntryRepository;
|
||||
use App\Shared\Domain\Contract\UserInterface;
|
||||
use App\State\ActiveTimeEntryProvider;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
@@ -77,10 +78,10 @@ class TimeEntry
|
||||
#[Groups(['time_entry:read', 'time_entry:write'])]
|
||||
private ?DateTimeImmutable $stoppedAt = null;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: User::class)]
|
||||
#[ORM\ManyToOne(targetEntity: UserInterface::class)]
|
||||
#[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
|
||||
#[Groups(['time_entry:read', 'time_entry:write'])]
|
||||
private ?User $user = null;
|
||||
private ?UserInterface $user = null;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: Project::class)]
|
||||
#[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')]
|
||||
@@ -160,12 +161,12 @@ class TimeEntry
|
||||
return $this;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user