31 lines
718B

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