mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-01 14:36:13 +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;
|
private ?ThirdParty $thirdParty = null;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ThirdParty|Person $caller,
|
ThirdParty|Person|null $caller,
|
||||||
#[ORM\ManyToOne(targetEntity: Ticket::class)]
|
#[ORM\ManyToOne(targetEntity: Ticket::class)]
|
||||||
#[ORM\JoinColumn(nullable: false)]
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
private Ticket $ticket,
|
private Ticket $ticket,
|
||||||
@ -129,12 +129,11 @@ class CallerHistory implements TrackCreationInterface
|
|||||||
*
|
*
|
||||||
* This is a private method and should be only called while instance creation
|
* 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) {
|
if ($caller instanceof Person) {
|
||||||
$this->setPerson($caller);
|
$this->setPerson($caller);
|
||||||
|
} elseif ($caller instanceof ThirdParty) {
|
||||||
} else {
|
|
||||||
$this->setThirdParty($caller);
|
$this->setThirdParty($caller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,7 +141,7 @@ class CallerHistory implements TrackCreationInterface
|
|||||||
/**
|
/**
|
||||||
* Get the caller, which can be either a Person or a ThirdParty.
|
* 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;
|
return $this->person ?? $this->thirdParty;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user