@@ -50,7 +50,12 @@ public function exportToCsv(?SubscriberFilter $filter = null, int $batchSize = 1
5050 $ tempFilePath = tempnam (sys_get_temp_dir (), 'subscribers_export_ ' );
5151 $ this ->logger ->debug ('Created temporary file for export ' , ['path ' => $ tempFilePath ]);
5252
53- $ this ->generateCsvContent ($ filter , $ batchSize , $ tempFilePath , $ filter ->getColumns ());
53+ $ this ->generateCsvContent (
54+ filter: $ filter ,
55+ batchSize: $ batchSize ,
56+ filePath: $ tempFilePath ,
57+ columns: $ filter ->getColumns (),
58+ );
5459
5560 $ response = new BinaryFileResponse ($ tempFilePath );
5661 $ response = $ this ->configureResponse ($ response );
@@ -80,10 +85,16 @@ private function generateCsvContent(
8085 /** @var SubscriberAttributeDefinition[] $attributeDefinitions */
8186 $ attributeDefinitions = $ this ->definitionRepository ->findAll ();
8287
83- $ headers = $ this ->getExportHeaders ($ attributeDefinitions , $ columns );
88+ $ headers = $ this ->getExportHeaders (attributeDefinitions: $ attributeDefinitions , columns: $ columns );
8489 fputcsv ($ handle , $ headers );
8590
86- $ this ->exportSubscribers ($ handle , $ filter , $ batchSize , $ attributeDefinitions , $ headers );
91+ $ this ->exportSubscribers (
92+ handle: $ handle ,
93+ filter: $ filter ,
94+ batchSize: $ batchSize ,
95+ attributeDefinitions: $ attributeDefinitions ,
96+ headers: $ headers ,
97+ );
8798
8899 fclose ($ handle );
89100 }
@@ -97,12 +108,20 @@ private function generateCsvContent(
97108 private function getExportHeaders (array $ attributeDefinitions , array $ columns ): array
98109 {
99110 $ headers = [
111+ 'id ' ,
100112 'email ' ,
101113 'confirmed ' ,
102114 'blacklisted ' ,
115+ // 'manualConfirm',
116+ 'bounceCount ' ,
117+ 'createdAt ' ,
118+ 'updatedAt ' ,
119+ 'uniqueId ' ,
103120 'htmlEmail ' ,
121+ 'rssFrequency ' ,
104122 'disabled ' ,
105123 'extraData ' ,
124+ 'foreignKey ' ,
106125 ];
107126
108127 foreach ($ attributeDefinitions as $ definition ) {
@@ -158,7 +177,11 @@ private function exportSubscribers(
158177 ]);
159178
160179 foreach ($ subscribers as $ subscriber ) {
161- $ row = $ this ->getSubscriberRow ($ subscriber , $ attributeDefinitions , $ headers );
180+ $ row = $ this ->getSubscriberRow (
181+ subscriber: $ subscriber ,
182+ attributeDefinitions: $ attributeDefinitions ,
183+ headers: $ headers ,
184+ );
162185 fputcsv ($ handle , $ row );
163186 $ lastId = $ subscriber ->getId ();
164187 }
@@ -193,9 +216,16 @@ private function getSubscriberRow(Subscriber $subscriber, array $attributeDefini
193216 'email ' => $ subscriber ->getEmail (),
194217 'confirmed ' => $ subscriber ->isConfirmed () ? '1 ' : '0 ' ,
195218 'blacklisted ' => $ subscriber ->isBlacklisted () ? '1 ' : '0 ' ,
219+ // 'manualConfirm' => $subscriber,
220+ 'bounceCount ' => $ subscriber ->getBounceCount (),
221+ 'createdAt ' => $ subscriber ->getCreatedAt ()?->format('Y-m-d H:i:s ' ) ?? '' ,
222+ 'updatedAt ' => $ subscriber ->getUpdatedAt ()?->format('Y-m-d H:i:s ' ) ?? '' ,
223+ 'uniqueId ' => $ subscriber ->getUniqueId (),
196224 'htmlEmail ' => $ subscriber ->hasHtmlEmail () ? '1 ' : '0 ' ,
225+ 'rssFrequency ' => $ subscriber ->getRssFrequency (),
197226 'disabled ' => $ subscriber ->isDisabled () ? '1 ' : '0 ' ,
198- 'extraData ' => $ subscriber ->getExtraData (),
227+ 'extraData ' => $ subscriber ->getExtraData () ?? '' ,
228+ 'foreignKey ' => $ subscriber ->getForeignKey () ?? '' ,
199229 ];
200230
201231 foreach ($ attributeDefinitions as $ definition ) {
0 commit comments