mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-17 07:49:54 +03: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
2 changed files with 8 additions and 3 deletions
|
@ -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…
Add table
Reference in a new issue