mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-12 01:54:41 +08:00
Make Visit::date field readonly
This commit is contained in:
@@ -139,7 +139,7 @@ class ImportedLinksProcessor implements ImportedLinksProcessorInterface
|
||||
$importedVisits = 0;
|
||||
foreach ($iterable as $importedOrphanVisit) {
|
||||
// Skip visits which are older than the most recent already imported visit's date
|
||||
if ($mostRecentOrphanVisit?->getDate()->greaterThanOrEquals(normalizeDate($importedOrphanVisit->date))) {
|
||||
if ($mostRecentOrphanVisit?->date->greaterThanOrEquals(normalizeDate($importedOrphanVisit->date))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ class ShortUrl extends AbstractEntity
|
||||
->setMaxResults(1);
|
||||
$visit = $this->visits->matching($criteria)->last();
|
||||
|
||||
return $visit instanceof Visit ? $visit->getDate() : null;
|
||||
return $visit instanceof Visit ? $visit->date : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,8 +29,7 @@ class Visit extends AbstractEntity implements JsonSerializable
|
||||
public readonly ?string $remoteAddr = null,
|
||||
public readonly ?string $visitedUrl = null,
|
||||
private ?VisitLocation $visitLocation = null,
|
||||
// TODO Make public readonly once VisitRepositoryTest does not try to set it
|
||||
private Chronos $date = new Chronos(),
|
||||
public readonly Chronos $date = new Chronos(),
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -147,14 +146,6 @@ class Visit extends AbstractEntity implements JsonSerializable
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function getDate(): Chronos
|
||||
{
|
||||
return $this->date;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
$base = [
|
||||
|
||||
Reference in New Issue
Block a user