您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

GlobalParam.php 856B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace Lc\ShopBundle\Services;
  3. use App\Repository\HubRepository;
  4. use Lc\ShopBundle\Context\GlobalParamInterface;
  5. use Lc\ShopBundle\Repository\MerchantRepository;
  6. use Symfony\Component\Security\Core\Security;
  7. class GlobalParam
  8. {
  9. protected $security;
  10. public function __construct(Security $security)
  11. {
  12. $this->security = $security ;
  13. }
  14. public function getCurrentMerchant()
  15. {
  16. $user = $this->security->getUser() ;
  17. if($user && $user->getMerchant()) {
  18. return $user->getMerchant() ;
  19. }
  20. else {
  21. return false ;
  22. }
  23. }
  24. public function getCurrentMerchantTaxRate()
  25. {
  26. return $this->getCurrentMerchant()->getTaxRate();
  27. }
  28. }