src/Controller/HomeController.php line 24
<?phpnamespace App\Controller;use App\Repository\BranchOfficeRepository;use App\Repository\MainCardRepository;use App\Repository\PartnerRepository;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;use Symfony\Component\HttpFoundation\Response;use Symfony\Component\Routing\Annotation\Route;class HomeController extends AbstractController{private $branchOffices;private $mapWidget;public function __construct(BranchOfficeRepository $branchOfficeRepository){$this->branchOffices = $branchOfficeRepository->findWidget2gisIsNotNull();shuffle($this->branchOffices);}#[Route('/', name: 'homepage')]public function index(MainCardRepository $mainCardRepository, PartnerRepository $partnerRepository): Response{if ($this->branchOffices){$this->mapWidget = ($this->branchOffices)[0]->getWidget2gis();}else{$this->mapWidget = '';}return $this->render('home/index.html.twig', ['main_cards' => $mainCardRepository->findAll(),'partners' => $partnerRepository->findAll(),'map_widget' => $this->mapWidget,]);}}