瀏覽代碼

MerchantResolver : ajout getAbsoluteUrl()

packProduct
Guillaume 3 年之前
父節點
當前提交
f4567cb0b7
共有 1 個文件被更改,包括 12 次插入1 次删除
  1. +12
    -1
      Resolver/MerchantResolver.php

+ 12
- 1
Resolver/MerchantResolver.php 查看文件

@@ -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…
取消
儲存