'%s', 'name' => '%s', 'slug' => '%s', 'description' => '%s', 'status' => '%s', 'duration' => '%d', 'duration_mode' => '%s', 'slot_interval' => '%d', 'buffer_before' => '%d', 'buffer_after' => '%d', 'capacity' => '%d', 'lead_time' => '%d', 'horizon' => '%d', 'price_minor' => '%d', 'price_basis' => '%s', 'color' => '%s', 'image_id' => '%d', 'sort' => '%d', 'updated_at' => '%s', ); } public function create( array $data ): int { $data['updated_at'] = self::now(); if ( empty( $data['slug'] ) && isset( $data['name'] ) ) { $data['slug'] = sanitize_title( (string) $data['name'] ); } return parent::create( $data ); } public function update( int $id, array $data ): void { $data['updated_at'] = self::now(); parent::update( $id, $data ); } /** * As a domain object. * * @param int $id ID. */ public function bookable( int $id ): ?Bookable { $row = $this->find( $id ); return null === $row ? null : Bookable::from_row( $row ); } }