mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-23 07:33:58 -06:00
Removed public readonly prop from entity, as it can cause errors when a proxy is generated
This commit is contained in:
parent
a93edf158e
commit
d8add9291f
@ -12,7 +12,7 @@ class DeviceLongUrl extends AbstractEntity
|
||||
{
|
||||
private function __construct(
|
||||
private readonly ShortUrl $shortUrl, // No need to read this field. It's used by doctrine
|
||||
public readonly DeviceType $deviceType,
|
||||
private readonly DeviceType $deviceType,
|
||||
private string $longUrl,
|
||||
) {
|
||||
}
|
||||
@ -27,6 +27,11 @@ class DeviceLongUrl extends AbstractEntity
|
||||
return $this->longUrl;
|
||||
}
|
||||
|
||||
public function deviceType(): DeviceType
|
||||
{
|
||||
return $this->deviceType;
|
||||
}
|
||||
|
||||
public function updateLongUrl(string $longUrl): void
|
||||
{
|
||||
$this->longUrl = $longUrl;
|
||||
|
@ -170,7 +170,7 @@ class ShortUrl extends AbstractEntity
|
||||
}
|
||||
foreach ($shortUrlEdit->deviceLongUrls as $deviceLongUrlPair) {
|
||||
$deviceLongUrl = $this->deviceLongUrls->findFirst(
|
||||
fn ($_, DeviceLongUrl $d) => $d->deviceType === $deviceLongUrlPair->deviceType,
|
||||
fn ($_, DeviceLongUrl $d) => $d->deviceType() === $deviceLongUrlPair->deviceType,
|
||||
);
|
||||
|
||||
if ($deviceLongUrl !== null) {
|
||||
@ -322,7 +322,7 @@ class ShortUrl extends AbstractEntity
|
||||
{
|
||||
$data = [];
|
||||
foreach ($this->deviceLongUrls as $deviceUrl) {
|
||||
$data[$deviceUrl->deviceType->value] = $deviceUrl->longUrl();
|
||||
$data[$deviceUrl->deviceType()->value] = $deviceUrl->longUrl();
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
Loading…
Reference in New Issue
Block a user