<?php
namespace App\Controller;
use App\Entity\Category;
use App\Entity\Partner;
use App\Entity\Product;
use App\Entity\Slider;
use App\Entity\Setting;
use App\Entity\SubCategory;
use Doctrine\ORM\EntityManagerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Finder\Exception\AccessDeniedException;
use Symfony\Component\Routing\Annotation\Route;
/**
* Class AdminController
* @package App\Controller
* @Route("/admin", name="admin-")
* @IsGranted("ROLE_WEBMASTER")
*/
class AdminController extends AbstractController
{
/** @var EntityManagerInterface */
private $em;
public function __construct(EntityManagerInterface $entityManager)
{
$this->em = $entityManager;
}
/**
* @Route("/", name="index")
*/
public function index()
{
return $this->render('admin/index.html.twig', [
'categories' => $this->em->getRepository(Category::class)->findAll(),
'subcategories' => $this->em->getRepository(SubCategory::class)->findAll(),
'partners' => $this->em->getRepository(Partner::class)->findAll(),
'products' => $this->em->getRepository(Product::class)->findAll(),
'sliders' => $this->em->getRepository(Slider::class)->findAll()
]);
}
}