wpdb; $key=\ABeCe\Booking\Infrastructure\Database\Tables::lock($wpdb,'prices'); if('1'!==(string)$wpdb->get_var($wpdb->prepare('SELECT GET_LOCK(%s, 5)',$key))) throw new CatalogException('abece_booking_database_error',__('The item could not be saved. Please try again.','abece-booking'),500); try { return $operation(); } finally { $wpdb->get_var($wpdb->prepare('SELECT RELEASE_LOCK(%s)',$key)); } } /** One consistent SQL read joins the complete configuration used by the calculation. */ public function configuration(): array { return BookingReadScope::remember($this->wpdb,$this->table.':configuration',function(){ $wpdb = $this->wpdb; $rows = $wpdb->get_results( $wpdb->prepare( 'SELECT r.*, l.name list_name, l.currency list_currency, l.priority list_priority, l.is_active list_active, l.valid_from list_valid_from, l.valid_to list_valid_to, l.season_id list_season_id, s.starts_on season_starts_on, s.ends_on season_ends_on, s.is_active season_active FROM %i r JOIN %i l ON l.id=r.price_list_id LEFT JOIN %i s ON s.id=l.season_id', $this->table, \ABeCe\Booking\Infrastructure\Database\Tables::name( $wpdb, 'price_lists' ), \ABeCe\Booking\Infrastructure\Database\Tables::name( $wpdb, 'seasons' ) ), ARRAY_A ); $this->checkRead();$rows=array_map([$this,'serialize'],$rows);return \ABeCe\Booking\Edition\Modules::current()->pricingRows($rows); }); } }