uery::class, ShippingRateTable::class ); $this->share_table_class( ShippingTimeTable::class ); $this->add_query_class( ShippingTimeQuery::class, ShippingTimeTable::class ); $this->share_table_class( MerchantIssueTable::class ); $this->add_query_class( MerchantIssueQuery::class, MerchantIssueTable::class ); $this->share_with_tags( ProductFeedQueryHelper::class, wpdb::class, ProductRepository::class ); $this->share_with_tags( ProductMetaQueryHelper::class, wpdb::class ); // Share DB migrations $this->share_migration( MigrationVersion141::class, MerchantIssueTable::class ); $this->share_migration( Migration20211228T1640692399::class, ShippingRateTable::class, OptionsInterface::class ); $this->share_with_tags( Migration20220524T1653383133::class, BudgetRecommendationTable::class ); $this->share_migration( Migration20231109T1653383133::class, BudgetRecommendationTable::class ); $this->share_with_tags( Migrator::class, MigrationInterface::class ); } /** * Add a query class. * * @param string $class_name * @param mixed ...$arguments * * @return DefinitionInterface */ protected function add_query_class( string $class_name, ...$arguments ): DefinitionInterface { return $this->add( $class_name, wpdb::class, ...$arguments )->addTag( 'db_query' ); } /** * Share a table class. * * Shared classes will always return the same instance of the class when the class is requested * from the container. * * @param string $class_name The class name to add. * @param mixed ...$arguments Constructor arguments for the class. * * @return DefinitionInterface */ protected function share_table_class( string $class_name, ...$arguments ): DefinitionInterface { return parent::share( $class_name, WP::class, wpdb::class, ...$arguments )->addTag( 'db_table' ); } /** * Share a migration class. * * @param string $class_name The class name to add. * @param mixed ...$arguments Constructor arguments for the class. * * @throws InvalidClass When the given class does not implement the MigrationInterface. * * @since 1.4.1 */ protected function share_migration( string $class_name, ...$arguments ) { $this->validate_interface( $class_name, MigrationInterface::class ); $this->share_with_tags( $class_name, wpdb::class, ...$arguments ); } }