Ensured old visit locations are deleted when relocating a visit that has already been located

This commit is contained in:
Alejandro Celaya
2020-03-28 09:27:45 +01:00
parent fb8ab0b5fe
commit 55778eb810
4 changed files with 12 additions and 6 deletions

View File

@@ -10,7 +10,6 @@ use Shlinkio\Shlink\Common\Entity\AbstractEntity;
use Shlinkio\Shlink\Common\Exception\InvalidArgumentException;
use Shlinkio\Shlink\Common\Util\IpAddress;
use Shlinkio\Shlink\Core\Model\Visitor;
use Shlinkio\Shlink\Core\Visit\Model\UnknownVisitLocation;
use Shlinkio\Shlink\Core\Visit\Model\VisitLocationInterface;
class Visit extends AbstractEntity implements JsonSerializable
@@ -60,9 +59,9 @@ class Visit extends AbstractEntity implements JsonSerializable
return $this->shortUrl;
}
public function getVisitLocation(): VisitLocationInterface
public function getVisitLocation(): ?VisitLocationInterface
{
return $this->visitLocation ?? new UnknownVisitLocation();
return $this->visitLocation;
}
public function isLocatable(): bool