Browse Source

MerchantResolver : ajout getAbsoluteUrl()

packProduct
Guillaume 2 years ago
parent
commit
f4567cb0b7
1 changed files with 12 additions and 1 deletions
  1. +12
    -1
      Resolver/MerchantResolver.php

+ 12
- 1
Resolver/MerchantResolver.php View File

@@ -126,7 +126,7 @@ class MerchantResolver
$merchant = $this->getCurrent();
}

//TODO Pas de REPO !!!!!
// @TODO Pas de REPO !!!!!
return $this->userMerchantRepository->findOneBy(
[
'user' => $user,
@@ -135,6 +135,17 @@ class MerchantResolver
);
}

public function getAbsoluteUrl(MerchantInterface $merchant, string $name, array $parameters = []): string
{
$url = $this->settingSolver->getSettingValue($merchant, MerchantSettingDefinition::SETTING_URL);

if(substr($url, strlen($url) - 1, 1) == '/') {
$url = substr($url, 0, strlen($url) - 1);
}

return $url . $this->router->generate($name, $parameters);
}

public function getUrl(SectionInterface $section)
{
$url = $this->settingSolver->getSettingValue($section->getMerchant(), MerchantSettingDefinition::SETTING_URL);

Loading…
Cancel
Save