You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			51 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
| <?php
 | |
| namespace App\Controller\Api;
 | |
| 
 | |
| use FOS\RestBundle\Controller\AbstractFOSRestController;
 | |
| use FOS\RestBundle\Controller\Annotations as Rest;
 | |
| use App\Repository\EventRepository;
 | |
| use App\Entity\Event;
 | |
| use App\Repository\EventBattleRepository;
 | |
| use App\Entity\EventBattle;
 | |
| 
 | |
| /**
 | |
|  *
 | |
|  * @Rest\Route("event/{eventId}/battle")
 | |
|  */
 | |
| class EventBattleController extends AbstractFOSRestController
 | |
| {
 | |
| 
 | |
|     protected EventBattleRepository $repository;
 | |
| 
 | |
|     public function __construct(EventBattleRepository $repository)
 | |
|     {
 | |
|         $this->repository = $repository;
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      *
 | |
|      * @Rest\Route("s")
 | |
|      * @Rest\View(serializerGroups={"Default", "event_battle_list"})
 | |
|      */
 | |
|     public function cgetAction(int $eventId): array
 | |
|     {
 | |
|         return $this->repository->findBy([
 | |
|             'event' => $eventId
 | |
|         ]);
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      *
 | |
|      * @Rest\Route("/{eid}"))
 | |
|      * @Rest\View(serializerGroups={"Default", "event_battle_show"})
 | |
|      */
 | |
|     public function getAction(int $eventId, int $eid): ?EventBattle
 | |
|     {
 | |
|         return $this->repository->findOneBy([
 | |
|             'event' => $eventId,
 | |
|             'eid' => $eid
 | |
|         ]);
 | |
|     }
 | |
| }
 | |
| 
 |