@@ -37,10 +37,7 @@ public function __construct(
3737 }
3838
3939 #[Route(path: '' , name: 'jury_team_affiliations ' )]
40- public function indexAction (
41- #[Autowire('%kernel.project_dir% ' )]
42- string $ projectDir
43- ): Response {
40+ public function indexAction (): Response {
4441 $ em = $ this ->em ;
4542 $ teamAffiliations = $ em ->createQueryBuilder ()
4643 ->select ('a ' , 'COUNT(t.teamid) AS num_teams ' )
@@ -53,8 +50,7 @@ public function indexAction(
5350 $ showFlags = $ this ->config ->get ('show_flags ' );
5451
5552 $ table_fields = [
56- 'affilid ' => ['title ' => 'ID ' , 'sort ' => true ],
57- 'externalid ' => ['title ' => 'external ID ' , 'sort ' => true ],
53+ 'externalid ' => ['title ' => 'ID ' , 'sort ' => true ],
5854 'icpcid ' => ['title ' => 'ICPC ID ' , 'sort ' => true ],
5955 'shortname ' => ['title ' => 'shortname ' , 'sort ' => true ],
6056 'name ' => ['title ' => 'name ' , 'sort ' => true , 'default_sort ' => true ],
@@ -77,7 +73,7 @@ public function indexAction(
7773 $ affiliationdata = [];
7874 $ affiliationactions = [];
7975
80- $ this ->addEntityCheckbox ($ affiliationdata , $ teamAffiliation , $ teamAffiliation ->getAffilid (), 'affiliation-checkbox ' );
76+ $ this ->addEntityCheckbox ($ affiliationdata , $ teamAffiliation , $ teamAffiliation ->getExternalid (), 'affiliation-checkbox ' );
8177
8278 // Get whatever fields we can from the affiliation object itself.
8379 foreach ($ table_fields as $ k => $ v ) {
@@ -91,14 +87,14 @@ public function indexAction(
9187 'icon ' => 'edit ' ,
9288 'title ' => 'edit this affiliation ' ,
9389 'link ' => $ this ->generateUrl ('jury_team_affiliation_edit ' , [
94- 'affilId ' => $ teamAffiliation ->getAffilid (),
90+ 'affilId ' => $ teamAffiliation ->getExternalid (),
9591 ])
9692 ];
9793 $ affiliationactions [] = [
9894 'icon ' => 'trash-alt ' ,
9995 'title ' => 'delete this affiliation ' ,
10096 'link ' => $ this ->generateUrl ('jury_team_affiliation_delete ' , [
101- 'affilId ' => $ teamAffiliation ->getAffilid (),
97+ 'affilId ' => $ teamAffiliation ->getExternalid (),
10298 ]),
10399 'ajaxModal ' => true ,
104100 ];
@@ -114,14 +110,14 @@ public function indexAction(
114110 }
115111
116112 $ affiliationdata ['affiliation_logo ' ] = [
117- 'value ' => $ teamAffiliation ->getExternalid () ?? $ teamAffiliation -> getAffilid () ,
113+ 'value ' => $ teamAffiliation ->getExternalid (),
118114 'title ' => $ teamAffiliation ->getShortname (),
119115 ];
120116
121117 $ team_affiliations_table [] = [
122118 'data ' => $ affiliationdata ,
123119 'actions ' => $ affiliationactions ,
124- 'link ' => $ this ->generateUrl ('jury_team_affiliation ' , ['affilId ' => $ teamAffiliation ->getAffilid ()]),
120+ 'link ' => $ this ->generateUrl ('jury_team_affiliation ' , ['affilId ' => $ teamAffiliation ->getExternalid ()]),
125121 ];
126122 }
127123
@@ -132,9 +128,9 @@ public function indexAction(
132128 }
133129
134130 #[Route(path: '/{affilId} ' , name: 'jury_team_affiliation ' )]
135- public function viewAction (Request $ request , ScoreboardService $ scoreboardService , int $ affilId ): Response
131+ public function viewAction (Request $ request , ScoreboardService $ scoreboardService , string $ affilId ): Response
136132 {
137- $ teamAffiliation = $ this ->em ->getRepository (TeamAffiliation::class)->find ($ affilId );
133+ $ teamAffiliation = $ this ->em ->getRepository (TeamAffiliation::class)->findByExternalId ($ affilId );
138134 if (!$ teamAffiliation ) {
139135 throw new NotFoundHttpException (sprintf ('Team affiliation with ID %s not found ' , $ affilId ));
140136 }
@@ -144,7 +140,7 @@ public function viewAction(Request $request, ScoreboardService $scoreboardServic
144140 'showFlags ' => $ this ->config ->get ('show_flags ' ),
145141 'refresh ' => [
146142 'after ' => 30 ,
147- 'url ' => $ this ->generateUrl ('jury_team_affiliation ' , ['affilId ' => $ teamAffiliation ->getAffilid ()]),
143+ 'url ' => $ this ->generateUrl ('jury_team_affiliation ' , ['affilId ' => $ teamAffiliation ->getExternalid ()]),
148144 'ajax ' => true ,
149145 ],
150146 'maxWidth ' => $ this ->config ->get ('team_column_width ' ),
@@ -171,10 +167,10 @@ public function viewAction(Request $request, ScoreboardService $scoreboardServic
171167 }
172168
173169 #[IsGranted('ROLE_ADMIN ' )]
174- #[Route(path: '/{affilId<\d+> }/edit ' , name: 'jury_team_affiliation_edit ' )]
175- public function editAction (Request $ request , int $ affilId ): Response
170+ #[Route(path: '/{affilId}/edit ' , name: 'jury_team_affiliation_edit ' )]
171+ public function editAction (Request $ request , string $ affilId ): Response
176172 {
177- $ teamAffiliation = $ this ->em ->getRepository (TeamAffiliation::class)->find ($ affilId );
173+ $ teamAffiliation = $ this ->em ->getRepository (TeamAffiliation::class)->findByExternalId ($ affilId );
178174 if (!$ teamAffiliation ) {
179175 throw new NotFoundHttpException (sprintf ('Team affiliation with ID %s not found ' , $ affilId ));
180176 }
@@ -186,7 +182,7 @@ public function editAction(Request $request, int $affilId): Response
186182 if ($ form ->isSubmitted () && $ form ->isValid ()) {
187183 $ this ->assetUpdater ->updateAssets ($ teamAffiliation );
188184 $ this ->saveEntity ($ teamAffiliation , $ teamAffiliation ->getAffilid (), false );
189- return $ this ->redirectToRoute ('jury_team_affiliation ' , ['affilId ' => $ teamAffiliation ->getAffilid ()]);
185+ return $ this ->redirectToRoute ('jury_team_affiliation ' , ['affilId ' => $ teamAffiliation ->getExternalid ()]);
190186 }
191187
192188 return $ this ->render ('jury/team_affiliation_edit.html.twig ' , [
@@ -196,10 +192,10 @@ public function editAction(Request $request, int $affilId): Response
196192 }
197193
198194 #[IsGranted('ROLE_ADMIN ' )]
199- #[Route(path: '/{affilId<\d+> }/delete ' , name: 'jury_team_affiliation_delete ' )]
200- public function deleteAction (Request $ request , int $ affilId ): Response
195+ #[Route(path: '/{affilId}/delete ' , name: 'jury_team_affiliation_delete ' )]
196+ public function deleteAction (Request $ request , string $ affilId ): Response
201197 {
202- $ teamAffiliation = $ this ->em ->getRepository (TeamAffiliation::class)->find ($ affilId );
198+ $ teamAffiliation = $ this ->em ->getRepository (TeamAffiliation::class)->findByExternalId ($ affilId );
203199 if (!$ teamAffiliation ) {
204200 throw new NotFoundHttpException (sprintf ('Team affiliation with ID %s not found ' , $ affilId ));
205201 }
@@ -208,20 +204,20 @@ public function deleteAction(Request $request, int $affilId): Response
208204 }
209205
210206 #[IsGranted('ROLE_ADMIN ' )]
211- #[Route(path: '/delete-multiple ' , name: 'jury_team_affiliation_delete_multiple ' , methods: ['GET ' , 'POST ' ])]
207+ #[Route(path: '/delete-multiple ' , name: 'jury_team_affiliation_delete_multiple ' , methods: ['GET ' , 'POST ' ], priority: 1 )]
212208 public function deleteMultipleAction (Request $ request ): Response
213209 {
214210 return $ this ->deleteMultiple (
215211 $ request ,
216212 TeamAffiliation::class,
217- 'affilid ' ,
213+ 'externalid ' ,
218214 'jury_team_affiliations ' ,
219215 'No affiliations could be deleted. '
220216 );
221217 }
222218
223219 #[IsGranted('ROLE_ADMIN ' )]
224- #[Route(path: '/add ' , name: 'jury_team_affiliation_add ' )]
220+ #[Route(path: '/add ' , name: 'jury_team_affiliation_add ' , priority: 1 )]
225221 public function addAction (Request $ request ): Response
226222 {
227223 $ teamAffiliation = new TeamAffiliation ();
@@ -232,7 +228,7 @@ public function addAction(Request $request): Response
232228
233229 if ($ response = $ this ->processAddFormForExternalIdEntity (
234230 $ form , $ teamAffiliation ,
235- fn () => $ this ->generateUrl ('jury_team_affiliation ' , ['affilId ' => $ teamAffiliation ->getAffilid ()]),
231+ fn () => $ this ->generateUrl ('jury_team_affiliation ' , ['affilId ' => $ teamAffiliation ->getExternalid ()]),
236232 function () use ($ teamAffiliation ) {
237233 $ this ->em ->persist ($ teamAffiliation );
238234 $ this ->assetUpdater ->updateAssets ($ teamAffiliation );
0 commit comments