Skip to content

Fleet, Dual-Source & Routing

Charter supports both native Entries fleets (charter-yachts) and existing ProcessWire Page templates (fleet_source: 'page') through a unified YachtSubjectResolver and CharterYachtResource (charter_yacht) abstraction.

Fleet lists yachts with category-prefixed reference codes, technical specs, minimum seasonal rate indicators, and Table/Cards viewports.

1. Dual-Source Fleet (YachtSubjectResolver & charter:scaffold:page)

Section titled “1. Dual-Source Fleet (YachtSubjectResolver & charter:scaffold:page)”
  • entry mode (default): Yachts live in charter-yachts, normalized automatically on save by YachtNormalizer (collision-free slugs, padded category-prefixed ref codes like GU-00001, normalized seasonal rates, recomputed min_price and has_rates).

  • page mode: Attach Charter’s 5 composable @fieldset:charter-* embedded fields (specs, cabins, amenities, rates, operations) onto an existing ProcessWire template:

    Terminal window
    php vendor/bin/wire charter:scaffold:page --template=yacht --sections=specs,cabins,amenities,rates,operations --dry-run --json

    In page mode, ProcessCharter edits yachts seamlessly via Entries’s DualSourceRecordEditor (?source=page) and CharterWorkspaceManager::createFleetPageProvider().

2. Fleet Search & Facets (FleetSearchService)

Section titled “2. Fleet Search & Facets (FleetSearchService)”
$results = $charter->fleet()->search([
'check_in' => '2026-07-11',
'check_out' => '2026-07-18',
'guests' => 8,
'cabins_min' => 4,
'amenities' => ['seabob', 'jacuzzi'], // AND-matching across amenity pivots
'currency' => 'EUR',
'limit' => 12,
]);
$facets = $charter->fleet()->facets();

FleetSearchService intersects live [check_in, check_out) availability from AvailabilityEngine, enriches matching yachts with PricingEngine quotes, and returns items, quotes, pagination, filters, and unavailableCount.

3. Frontend Routing & Entity Classes (CharterRouter)

Section titled “3. Frontend Routing & Entity Classes (CharterRouter)”

Configure fleet_parent_page, destinations_parent_page, or fleet_templates in Charter Settings -> Routing & Yacht Refs. CharterRouter::resolve($page, $input) evaluates 0/1/2 URL segments (throwing Wire404Exception on unknown or 3+ segment paths) and returns a CharterRouteMatch (kind, isCanonical, canonicalUrl, yachtId, categoryId, destinationId).

Three typed entity classes expose localized URL helpers (url(), httpUrl(), localUrl(), localHttpUrl(), localizedSlug()):

  • YachtEntry (charter-yachts): Also provides urlInCategory(), canonicalUrl(), hasCategory(), rateBlocks(), allAmenities(), and amenitiesByCategory().
  • YachtCategoryEntry (charter-yacht-categories)
  • DestinationEntry (charter-destinations)

4. Structured JSON Fleet Import (CharterImporter & charter:import)

Section titled “4. Structured JSON Fleet Import (CharterImporter & charter:import)”

Import structured JSON yacht catalogs, amenity pivots, and seasonal rates safely via CLI:

Terminal window
php vendor/bin/wire charter:import --path=site/assets/imports/aegean-fleet --mode=skip --dry-run --json
php vendor/bin/wire charter:import --path=site/assets/imports/aegean-fleet --mode=upsert --force --json

Next steps