e function convert_item( int $meta_id, string $meta_value ) { global $wpdb; //phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize $coupon_data = unserialize( $meta_value ); $temp_coupon = new \WC_Coupon(); $temp_coupon->set_props( $coupon_data ); //phpcs:disable WordPress.DB.SlowDBQuery $wpdb->update( "{$wpdb->prefix}woocommerce_order_itemmeta", array( 'meta_key' => 'coupon_info', 'meta_value' => $temp_coupon->get_short_info(), ), array( 'meta_id' => $meta_id ) ); //phpcs:enable WordPress.DB.SlowDBQuery if ( $wpdb->last_error ) { throw new Exception( $wpdb->last_error ); } } /** * Default (preferred) batch size to pass to 'get_next_batch_to_process'. * * @return int Default batch size. */ public function get_default_batch_size(): int { return 1000; } /** * Add the tool to start or stop the background process that converts order coupon metadata entries. * * @param array $tools Old tools array. * @return array Updated tools array. */ private function handle_woocommerce_debug_tools( array $tools ): array { $batch_processor = wc_get_container()->get( BatchProcessingController::class ); $pending_count = $this->get_total_pending_count(); if ( 0 === $pending_count ) { $tools['start_convert_order_coupon_data'] = array( 'name' => __( 'Start converting order coupon data to the simplified format', 'woocommerce' ), 'button' => __( 'Start converting', 'woocommerce' ), 'disabled' => true, 'desc' => __( 'This will convert coupon_data order item meta entries to simplified coupon_info entries. The conversion will happen overtime in the background (via Action Scheduler). There are currently no entries to convert.', 'woocommerce' ), ); } elseif ( $batch_processor->is_enqueued( self::class ) ) { $tools['stop_convert_order_coupon_data'] = array( 'name' => __( 'Stop converting order coupon data to the simplified format', 'woocommerce' ), 'button' => __( 'Stop converting', 'woocommerce' ), 'desc' => /* translators: %d=count of entries pending conversion */ sprintf( __( 'This will stop the background process that converts coupon_data order item meta entries to simplified coupon_info entries. There are currently %d entries that can be converted.', 'woocommerce' ), $pending_count ), 'callback' => array( $this, 'dequeue' ), ); } else { $tools['start_converting_order_coupon_data'] = array( 'name' => __( 'Convert order coupon data to the simplified format', 'woocommerce' ), 'button' => __( 'Start converting', 'woocommerce' ), 'desc' => /* translators: %d=count of entries pending conversion */ sprintf( __( 'This will convert coupon_data order item meta entries to simplified coupon_info entries. The conversion will happen overtime in the background (via Action Scheduler). There are currently %d entries that can be converted.', 'woocommerce' ), $pending_count ), 'callback' => array( $this, 'enqueue' ), ); } return $tools; } /** * Start the background process for coupon data conversion. * * @return string Informative string to show after the tool is triggered in UI. */ private function enqueue(): string { $batch_processor = wc_get_container()->get( BatchProcessingController::class ); if ( $batch_processor->is_enqueued( self::class ) ) { return __( 'Background process for coupon meta conversion already started, nothing done.', 'woocommerce' ); } $batch_processor->enqueue_processor( self::class ); return __( 'Background process for coupon meta conversion started', 'woocommerce' ); } /** * Stop the background process for coupon data conversion. * * @return string Informative string to show after the tool is triggered in UI. */ private function dequeue(): string { $batch_processor = wc_get_container()->get( BatchProcessingController::class ); if ( ! $batch_processor->is_enqueued( self::class ) ) { return __( 'Background process for coupon meta conversion not started, nothing done.', 'woocommerce' ); } $batch_processor->remove_processor( self::class ); return __( 'Background process for coupon meta conversion stopped', 'woocommerce' ); } }
Warning: class_implements(): Class Automattic\WooCommerce\Internal\OrderCouponDataMigrator does not exist and could not be loaded in /htdocs/wp-content/plugins/woocommerce/src/Internal/DependencyManagement/ServiceProviders/AbstractInterfaceServiceProvider.php on line 61

Warning: foreach() argument must be of type array|object, bool given in /htdocs/wp-content/plugins/woocommerce/src/Internal/DependencyManagement/ServiceProviders/AbstractInterfaceServiceProvider.php on line 61
// Prevent overwrite in case of inherit classes using same property name (See AbstractHydrator) if (!isset($data[$fieldName]) || !$valueIsNull) { $data[$fieldName] = $value; } } if (isset($this->_hints[Query::HINT_REFRESH_ENTITY])) { $this->registerManaged($this->class, $this->_hints[Query::HINT_REFRESH_ENTITY], $data); } $uow = $this->_em->getUnitOfWork(); $entity = $uow->createEntity($entityName, $data, $this->_hints); $result[] = $entity; if (isset($this->_hints[Query::HINT_INTERNAL_ITERATION]) && $this->_hints[Query::HINT_INTERNAL_ITERATION]) { $this->_uow->hydrationComplete(); } } }
Fatal error: Uncaught Error: Class "MailPoetVendor\Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator" not found in /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:422 Stack trace: #0 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(481): MailPoetVendor\Doctrine\ORM\EntityManager->newHydrator(5) #1 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php(79): MailPoetVendor\Doctrine\ORM\Persisters\Entity\BasicEntityPersister->loadAll(Array, NULL, NULL, NULL) #2 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php(74): MailPoetVendor\Doctrine\ORM\EntityRepository->findBy(Array) #3 /htdocs/wp-content/plugins/mailpoet/lib/Doctrine/Repository.php(84): MailPoetVendor\Doctrine\ORM\EntityRepository->findAll() #4 /htdocs/wp-content/plugins/mailpoet/lib/Settings/SettingsController.php(147): MailPoet\Doctrine\Repository->findAll() #5 /htdocs/wp-content/plugins/mailpoet/lib/Settings/SettingsController.php(37): MailPoet\Settings\SettingsController->ensureLoaded() #6 /htdocs/wp-content/plugins/mailpoet/lib/Config/Hooks.php(140): MailPoet\Settings\SettingsController->get('subscribe', Array) #7 /htdocs/wp-content/plugins/mailpoet/lib/Config/Hooks.php(121): MailPoet\Config\Hooks->setupSubscriptionEvents() #8 /htdocs/wp-content/plugins/mailpoet/lib/Config/Initializer.php(342): MailPoet\Config\Hooks->init() #9 /htdocs/wp-includes/class-wp-hook.php(324): MailPoet\Config\Initializer->pluginsLoaded('') #10 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #11 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #12 /htdocs/wp-settings.php(559): do_action('plugins_loaded') #13 /htdocs/wp-config.php(85): require_once('/htdocs/wp-sett...') #14 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #15 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #16 /htdocs/index.php(17): require('/htdocs/wp-blog...') #17 {main} thrown in /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/EntityManager.php on line 422