<?php
namespace App\Service;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\Session\Session;
class GlobalService
{
protected $mr;
protected $session;
protected $office;
public function __construct(ManagerRegistry $managerRegistry, Session $session)
{
$this->mr = $managerRegistry;
$this->session = $session;
}
public function getSelectedOffice(){
$id = $this->session->get('officeId');
$office = $this->mr->getManager('master')->getRepository("App\Entity\Master\Office")->findOneById($id);
$this->office = $office;
return $office;
}
public function getCityToStringById($id){
$city = $this->mr->getManager('master')->getRepository("App\Entity\Master\Office")->findOneById($id);
$this->office = $office;
return $office;
}
public function getOffice(){
return $this->office;
}
}