mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-30 22:16:14 +00:00
Allow caller to be null
This commit is contained in:
parent
0cf922be64
commit
df745a1c6a
@ -53,7 +53,7 @@ class CallerHistory implements TrackCreationInterface
|
||||
private ?ThirdParty $thirdParty = null;
|
||||
|
||||
public function __construct(
|
||||
ThirdParty|Person $caller,
|
||||
ThirdParty|Person|null $caller,
|
||||
#[ORM\ManyToOne(targetEntity: Ticket::class)]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private Ticket $ticket,
|
||||
@ -129,12 +129,11 @@ class CallerHistory implements TrackCreationInterface
|
||||
*
|
||||
* This is a private method and should be only called while instance creation
|
||||
*/
|
||||
private function setCaller(Person|ThirdParty $caller): void
|
||||
private function setCaller(Person|ThirdParty|null $caller): void
|
||||
{
|
||||
if ($caller instanceof Person) {
|
||||
$this->setPerson($caller);
|
||||
|
||||
} else {
|
||||
} elseif ($caller instanceof ThirdParty) {
|
||||
$this->setThirdParty($caller);
|
||||
}
|
||||
}
|
||||
@ -142,7 +141,7 @@ class CallerHistory implements TrackCreationInterface
|
||||
/**
|
||||
* Get the caller, which can be either a Person or a ThirdParty.
|
||||
*/
|
||||
public function getCaller(): Person|ThirdParty
|
||||
public function getCaller(): Person|ThirdParty|null
|
||||
{
|
||||
return $this->person ?? $this->thirdParty;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user