app/Plugin/CourcesManagerPlugin/Controller/CourseController.php line 46

Open in your IDE?
  1. <?php
  2. namespace Plugin\CourcesManagerPlugin\Controller;
  3. use Customize\Repository\ProductRepositoryCustomize;
  4. use Eccube\Controller\AbstractController;
  5. use Google\Service\Classroom\Resource\Courses;
  6. use Plugin\CourcesManagerPlugin\Entity\TjoCourse;
  7. use Plugin\CourcesManagerPlugin\Repository\Admin\TjoCourseRepository;
  8. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. class CourseController extends AbstractController{
  11.     /** @var TjoCourseRepository */
  12.     protected $courseRepository;
  13.     
  14.     /** @var ProductRepositoryCustomize */
  15.     protected $productRepository;
  16.     public function __construct(
  17.         TjoCourseRepository         $courseRepository,
  18.         ProductRepositoryCustomize  $productRepository
  19.     ){
  20.         $this->courseRepository     $courseRepository;
  21.         $this->productRepository    $productRepository;
  22.     }
  23.     /**
  24.      * @Route("/course", name="course_index", methods={"GET"})
  25.      * @Template("CourcesManagerPlugin/Resource/template/default/index.twig")
  26.      */
  27.     public function index(){
  28.         return [
  29.             'courses'       => $this->courseRepository->getCourses(),
  30.         ];
  31.     }
  32.     /**
  33.      * @Route("/course/{id}/detail", name="course_detail", methods={"GET"}, requirements={"id" = "\d+"})
  34.      * @Template("CourcesManagerPlugin/Resource/template/default/detail.twig")
  35.      */
  36.     public function detail(TjoCourse $course){
  37.         $ticket $this->productRepository->getProductSales(1);
  38.         $drives $this->productRepository->getProductSales(2);
  39.         return [
  40.             'ticket'        => $ticket,
  41.             'drives'        => $drives,
  42.             'course'        => $course,
  43.         ];
  44.     }
  45. }