src/Service/GlobalService.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Service;
  3. use Doctrine\Persistence\ManagerRegistry;
  4. use Symfony\Component\HttpFoundation\Session\Session;
  5. class GlobalService
  6. {
  7.     protected $mr;
  8.     protected $session;
  9.     protected $office;
  10.     public function __construct(ManagerRegistry $managerRegistrySession $session)
  11.     {
  12.         $this->mr $managerRegistry;
  13.         $this->session $session;
  14.     }
  15.     public function getSelectedOffice(){
  16.         $id $this->session->get('officeId');
  17.         $office $this->mr->getManager('master')->getRepository("App\Entity\Master\Office")->findOneById($id);
  18.         $this->office $office;
  19.         return $office;
  20.     }
  21.     public function getCityToStringById($id){
  22.         $city $this->mr->getManager('master')->getRepository("App\Entity\Master\Office")->findOneById($id);
  23.         $this->office $office;
  24.         return $office;
  25.     }
  26.     public function getOffice(){
  27.         return $this->office;
  28.     }
  29. }