<?php
namespace Plugin\CourcesManagerPlugin\Controller;
use Customize\Repository\ProductRepositoryCustomize;
use Eccube\Controller\AbstractController;
use Google\Service\Classroom\Resource\Courses;
use Plugin\CourcesManagerPlugin\Entity\TjoCourse;
use Plugin\CourcesManagerPlugin\Repository\Admin\TjoCourseRepository;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Routing\Annotation\Route;
class CourseController extends AbstractController{
/** @var TjoCourseRepository */
protected $courseRepository;
/** @var ProductRepositoryCustomize */
protected $productRepository;
public function __construct(
TjoCourseRepository $courseRepository,
ProductRepositoryCustomize $productRepository
){
$this->courseRepository = $courseRepository;
$this->productRepository = $productRepository;
}
/**
* @Route("/course", name="course_index", methods={"GET"})
* @Template("CourcesManagerPlugin/Resource/template/default/index.twig")
*/
public function index(){
return [
'courses' => $this->courseRepository->getCourses(),
];
}
/**
* @Route("/course/{id}/detail", name="course_detail", methods={"GET"}, requirements={"id" = "\d+"})
* @Template("CourcesManagerPlugin/Resource/template/default/detail.twig")
*/
public function detail(TjoCourse $course){
$ticket = $this->productRepository->getProductSales(1);
$drives = $this->productRepository->getProductSales(2);
return [
'ticket' => $ticket,
'drives' => $drives,
'course' => $course,
];
}
}