4646use models \exceptions \ValidationException ;
4747use models \main \ICompanyRepository ;
4848use models \main \IMemberRepository ;
49+ use models \main \ITagRepository ;
4950use models \main \Member ;
5051use models \oauth2 \IResourceServerContext ;
5152use models \summit \factories \SummitAttendeeFactory ;
@@ -1088,6 +1089,11 @@ final class SummitOrderService
10881089 */
10891090 private $ ticket_finder_strategy_factory ;
10901091
1092+ /**
1093+ * @var ITagRepository
1094+ */
1095+ private $ tags_repository ;
1096+
10911097 /**
10921098 * @param ISummitTicketTypeRepository $ticket_type_repository
10931099 * @param IMemberRepository $member_repository
@@ -1103,6 +1109,7 @@ final class SummitOrderService
11031109 * @param IFileUploadStrategy $upload_strategy
11041110 * @param IFileDownloadStrategy $download_strategy
11051111 * @param ICompanyRepository $company_repository
1112+ * @param ITagRepository $tags_repository
11061113 * @param ICompanyService $company_service
11071114 * @param ITicketFinderStrategyFactory $ticket_finder_strategy_factory
11081115 * @param ITransactionService $tx_service
@@ -1124,6 +1131,7 @@ public function __construct
11241131 IFileUploadStrategy $ upload_strategy ,
11251132 IFileDownloadStrategy $ download_strategy ,
11261133 ICompanyRepository $ company_repository ,
1134+ ITagRepository $ tags_repository ,
11271135 ICompanyService $ company_service ,
11281136 ITicketFinderStrategyFactory $ ticket_finder_strategy_factory ,
11291137 ITransactionService $ tx_service ,
@@ -1148,6 +1156,7 @@ public function __construct
11481156 $ this ->company_repository = $ company_repository ;
11491157 $ this ->company_service = $ company_service ;
11501158 $ this ->ticket_finder_strategy_factory = $ ticket_finder_strategy_factory ;
1159+ $ this ->tags_repository = $ tags_repository ;
11511160 }
11521161
11531162 /**
@@ -3473,6 +3482,7 @@ public function importTicketData(Summit $summit, UploadedFile $csv_file): void
34733482 * attendee_email ( mandatory if id and number are missing)
34743483 * attendee_first_name (mandatory)
34753484 * attendee_last_name (mandatory)
3485+ * attendee_tags (optional)
34763486 * attendee_company (optional)
34773487 * attendee_company_id (optional)
34783488 * ticket_type_name ( mandatory if id and number are missing)
@@ -3605,8 +3615,18 @@ public function processTicketData(int $summit_id, string $filename)
36053615
36063616 Log::debug (sprintf ("SummitOrderService::processTicketData creating attendee with payload %s " , json_encode ($ payload )));
36073617
3618+
36083619 $ attendee = SummitAttendeeFactory::build ($ summit , $ payload , $ member );
36093620
3621+ if ($ reader ->hasColumn ('attendee_tags ' )) {
3622+ $ tags = explode ('| ' , $ row ['attendee_tags ' ]);
3623+ $ attendee ->clearTags ();
3624+ foreach ($ tags as $ tag_val ) {
3625+ $ tag = $ this ->tags_repository ->getByTag ($ tag_val );
3626+ if (is_null ($ tag )) continue ;
3627+ $ attendee ->addTag ($ tag );
3628+ }
3629+ }
36103630 $ this ->attendee_repository ->add ($ attendee );
36113631 }
36123632 }
0 commit comments