mirror of
https://github.com/shlinkio/shlink.git
synced 2025-01-11 00:22:04 -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 function __construct(
|
||||||
private readonly ShortUrl $shortUrl, // No need to read this field. It's used by doctrine
|
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,
|
private string $longUrl,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
@ -27,6 +27,11 @@ class DeviceLongUrl extends AbstractEntity
|
|||||||
return $this->longUrl;
|
return $this->longUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function deviceType(): DeviceType
|
||||||
|
{
|
||||||
|
return $this->deviceType;
|
||||||
|
}
|
||||||
|
|
||||||
public function updateLongUrl(string $longUrl): void
|
public function updateLongUrl(string $longUrl): void
|
||||||
{
|
{
|
||||||
$this->longUrl = $longUrl;
|
$this->longUrl = $longUrl;
|
||||||
|
@ -170,7 +170,7 @@ class ShortUrl extends AbstractEntity
|
|||||||
}
|
}
|
||||||
foreach ($shortUrlEdit->deviceLongUrls as $deviceLongUrlPair) {
|
foreach ($shortUrlEdit->deviceLongUrls as $deviceLongUrlPair) {
|
||||||
$deviceLongUrl = $this->deviceLongUrls->findFirst(
|
$deviceLongUrl = $this->deviceLongUrls->findFirst(
|
||||||
fn ($_, DeviceLongUrl $d) => $d->deviceType === $deviceLongUrlPair->deviceType,
|
fn ($_, DeviceLongUrl $d) => $d->deviceType() === $deviceLongUrlPair->deviceType,
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($deviceLongUrl !== null) {
|
if ($deviceLongUrl !== null) {
|
||||||
@ -322,7 +322,7 @@ class ShortUrl extends AbstractEntity
|
|||||||
{
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
foreach ($this->deviceLongUrls as $deviceUrl) {
|
foreach ($this->deviceLongUrls as $deviceUrl) {
|
||||||
$data[$deviceUrl->deviceType->value] = $deviceUrl->longUrl();
|
$data[$deviceUrl->deviceType()->value] = $deviceUrl->longUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
Loading…
Reference in New Issue
Block a user