File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -225,6 +225,37 @@ function ( $c ) use ( $prepared_ids ) {
225225 * @return array<string> The prepared statements and values.
226226 */
227227 protected static function prepare_statements_values ( array $ entries ): array {
228+ $ uid_column = static ::uid_column ();
229+ $ entries = array_map (
230+ function ( $ entry ) use ( $ uid_column ) {
231+ unset( $ entry [ $ uid_column ] );
232+ return $ entry ;
233+ },
234+ $ entries
235+ );
236+
237+ $ columns = static ::get_columns ();
238+
239+ $ entries = array_map (
240+ function ( $ entry ) use ( $ columns ) {
241+ foreach ( $ columns as $ column ) {
242+ if ( ! isset ( $ entry [ $ column ->get_name () ] ) ) {
243+ continue ;
244+ }
245+
246+ switch ( $ column ->get_php_type () ) {
247+ case Column::PHP_TYPE_JSON :
248+ $ entry [ $ column ->get_name () ] = wp_json_encode ( $ entry [ $ column ->get_name () ] );
249+ break ;
250+ default :
251+ break ;
252+ }
253+ }
254+ return $ entry ;
255+ },
256+ $ entries
257+ );
258+
228259 $ database = Config::get_db ();
229260 $ columns = array_keys ( $ entries [0 ] );
230261 $ prepared_columns = implode (
You can’t perform that action at this time.
0 commit comments