@@ -37,6 +37,18 @@ enum: ['any', 'signup', 'changed', 'changelog', 'subscribed']
3737 type: 'string ' ,
3838 format: 'date '
3939 ),
40+ new OA \Property (
41+ property: 'is_confirmed ' ,
42+ description: 'Whether subscriber is confirmed (true, false, 1, 0) ' ,
43+ type: 'boolean ' ,
44+ enum: ['true ' , 'false ' , '1 ' , '0 ' , true , false , 1 , 0 ]
45+ ),
46+ new OA \Property (
47+ property: 'is_blacklisted ' ,
48+ description: 'Whether subscriber is blacklisted (true, false, 1, 0) ' ,
49+ type: 'boolean ' ,
50+ enum: ['true ' , 'false ' , '1 ' , '0 ' , true , false , 1 , 0 ]
51+ ),
4052 new OA \Property (
4153 property: 'columns ' ,
4254 description: 'Columns to include in the export ' ,
@@ -104,6 +116,18 @@ class SubscribersExportRequest implements RequestInterface
104116 'foreignKey ' ,
105117 ];
106118
119+ #[Assert \Choice(
120+ choices: ['true ' , 'false ' , '1 ' , '0 ' , true , false , 1 , 0 ],
121+ message: 'isConfirmed must be one of: true, false, 1, 0 '
122+ )]
123+ public mixed $ isConfirmed = null ;
124+
125+ #[Assert \Choice(
126+ choices: ['true ' , 'false ' , '1 ' , '0 ' , true , false , 1 , 0 ],
127+ message: 'isBlacklisted must be one of: true, false, 1, 0 '
128+ )]
129+ public mixed $ isBlacklisted = null ;
130+
107131 private function resolveDates (): array
108132 {
109133 $ dateFrom = $ this ->dateFrom ? new DateTimeImmutable ($ this ->dateFrom ) : null ;
@@ -130,7 +154,22 @@ public function getDto(): SubscriberFilter
130154 createdDateTo: $ signupTo ,
131155 updatedDateFrom: $ changedFrom ,
132156 updatedDateTo: $ changedTo ,
133- columns: $ this ->columns
157+ isConfirmed: $ this ->normalizeBoolean ($ this ->isConfirmed ),
158+ isBlacklisted: $ this ->normalizeBoolean ($ this ->isBlacklisted ),
159+ columns: $ this ->columns ,
134160 );
135161 }
162+
163+ private function normalizeBoolean (mixed $ value ): ?bool
164+ {
165+ if ($ value === null ) {
166+ return null ;
167+ }
168+
169+ if (is_bool ($ value )) {
170+ return $ value ;
171+ }
172+
173+ return (bool ) filter_var ($ value , FILTER_VALIDATE_BOOLEAN );
174+ }
136175}
0 commit comments