You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
856B

  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. }