ion ) { $exception_class = get_class( $exception ); $this->error_logger->error( "PostsToOrdersMigrationController: when executing $query: ($exception_class) {$exception->getMessage()}, {$exception->getTraceAsString()}", array( 'source' => self::LOGS_SOURCE_NAME, 'exception' => $exception, ) ); return false; } $error = $wpdb->last_error; if ( '' !== $error ) { $this->error_logger->error( "PostsToOrdersMigrationController: when executing $query: $error", array( 'source' => self::LOGS_SOURCE_NAME, 'error' => $error, ) ); return false; } return true; } /** * Verify whether the given order IDs were migrated properly or not. * * @param array $order_post_ids Order IDs. * * @return array Array of failed IDs along with columns. */ public function verify_migrated_orders( array $order_post_ids ): array { $errors = array(); foreach ( $this->all_migrators as $migrator ) { if ( method_exists( $migrator, 'verify_migrated_data' ) ) { $errors = $errors + $migrator->verify_migrated_data( $order_post_ids ); } } return $errors; } /** * Migrates an order from the posts table to the custom orders tables. * * @param int $order_post_id Post ID of the order to migrate. */ public function migrate_order( int $order_post_id ): void { $this->migrate_orders( array( $order_post_id ) ); } }