Skip to content

Commit

Permalink
[TASK] Use setter for domain property in some objects in a classic way
Browse files Browse the repository at this point in the history
This helps if new objects should be created via extbase property mapper (e.g. via API) where a domain is given
  • Loading branch information
einpraegsam committed Feb 1, 2024
1 parent 8ae77dc commit 3c58a86
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 6 deletions.
8 changes: 7 additions & 1 deletion Classes/Domain/Model/Download.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ public function getDomain(): string
return $this->domain;
}

public function setDomain(): self
public function setDomain(string $domain): self
{
$this->domain = $domain;
return $this;
}

public function setDomainAutomatically(): self
{
$this->domain = FrontendUtility::getCurrentDomain();
return $this;
Expand Down
8 changes: 7 additions & 1 deletion Classes/Domain/Model/Newsvisit.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,13 @@ public function getDomain(): string
return $this->domain;
}

public function setDomain(): self
public function setDomain(string $domain): self
{
$this->domain = $domain;
return $this;
}

public function setDomainAutomatically(): self
{
$this->domain = FrontendUtility::getCurrentDomain();
return $this;
Expand Down
8 changes: 7 additions & 1 deletion Classes/Domain/Model/Pagevisit.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,13 @@ public function getDomain(): string
return $this->domain;
}

public function setDomain(): self
public function setDomain(string $domain): self
{
$this->domain = $domain;
return $this;
}

public function setDomainAutomatically(): self
{
$this->domain = FrontendUtility::getCurrentDomain();
return $this;
Expand Down
3 changes: 2 additions & 1 deletion Classes/Domain/Tracker/DownloadTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ protected function getAndPersistNewDownload(string $href, int $pageIdentifier):
$downloadRepository = GeneralUtility::makeInstance(DownloadRepository::class);
$pageRepository = GeneralUtility::makeInstance(PageRepository::class);
$page = $pageRepository->findByIdentifier($pageIdentifier);
$download = GeneralUtility::makeInstance(Download::class)->setHref($href)->setPage($page)->setDomain();
$download = GeneralUtility::makeInstance(Download::class)
->setHref($href)->setPage($page)->setDomainAutomatically();
if ($file !== null) {
$download->setFile($file);
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Tracker/NewsTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected function getNewsvisit(
$newsvisit
->setNews($news)
->setLanguage($languageUid)
->setDomain()
->setDomainAutomatically()
->setVisitor($visitor)
->setPagevisit($pagevisit);
return $newsvisit;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Tracker/PageTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected function getPageVisit(int $pageUid, int $languageUid, string $referrer
->setPage($page)
->setLanguage($languageUid)
->setReferrer($referrer)
->setDomain()
->setDomainAutomatically()
->setVisitor($visitor);
return $pageVisit;
}
Expand Down

0 comments on commit 3c58a86

Please sign in to comment.