Skip to content

Commit

Permalink
get rid of static: according to change reqs
Browse files Browse the repository at this point in the history
  • Loading branch information
ferishili committed Nov 7, 2023
1 parent d2396e9 commit c23bcea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ class xoctPublicationUsageGUI extends xoctGUI
* @var PublicationUsageRepository
*/
protected $repository;
/**
* @var PublicationSubUsageRepository
*/
protected $sub_repository;
/**
* @var string
*/
Expand Down Expand Up @@ -92,6 +96,7 @@ public function __construct()
$this->post_id = (int) $this->http->request()->getParsedBody()['id'] ?? null;
$this->channel = $this->http->request()->getParsedBody()[xoctPublicationUsageFormGUI::F_CHANNEL] ?? null;
$this->repository = new PublicationUsageRepository();
$this->sub_repository = new PublicationSubUsageRepository();
$this->setTab();

}
Expand Down Expand Up @@ -318,7 +323,7 @@ protected function addSub()
$xoctPublicationSubUsage = new PublicationSubUsage();
$xoctPublicationSubUsage->setParentUsageId($channel);
$title_text = $this->txt('type_' . $channel);
$title = PublicationSubUsageRepository::generateTitle($channel, $title_text);
$title = $this->sub_repository->generateTitle($channel, $title_text);
$xoctPublicationSubUsage->setTitle($title);
$xoctPublicationSubUsageFormGUI = new xoctPublicationSubUsageFormGUI($this, $xoctPublicationSubUsage);
$xoctPublicationSubUsageFormGUI->fillForm();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public function getDisplayName(int $sub_id): string
* @param string $title_text
* @return string
*/
public static function generateTitle(string $parent_usage_id, string $title_text): string
public function generateTitle(string $parent_usage_id, string $title_text): string
{
$count_subs = PublicationSubUsage::where(['parent_usage_id' => $parent_usage_id])->count();
return $title_text . " (" . self::translate('publication_usage_sub') . "-" . ($count_subs + 1) . ")";
return $title_text . " (" . $this->translate('publication_usage_sub') . "-" . ($count_subs + 1) . ")";
}

/**
Expand Down

0 comments on commit c23bcea

Please sign in to comment.