PHP API, Hooks & CLI
Resolve Charter via $this->wire()->charter or ProcessWire\Charter::requireInstance($wire).
Core Service Accessors (ProcessWire\Charter)
Section titled “Core Service Accessors (ProcessWire\Charter)”| Method | Returned Service |
|---|---|
settings() |
CharterSettings (cached per instance; invalidated on entry mutations) |
yachts() |
YachtSubjectResolver (dual-source entry:<uuid> / page:<id> resolver) |
fleet() |
FleetSearchService (search(), facets()) |
pricing() |
PricingEngine (calculate()) |
rates() |
RateMatrixService (listPage(), saveYachtRates(), bulkAdjustPrices()) |
currencies() |
CurrencyConverter (fail-closed Currency bridge) |
availability() |
AvailabilityEngine (isAvailable(), findConflicts(), withYachtLock(), expireOverdueHolds()) |
workflow() |
BookingWorkflowService (createInquiryFromSubmission(), convertInquiryToBooking(), recalculateBookingPricing()) |
proposals() |
QuoteProposalRenderer (createShareToken(), shareUrl(), renderByToken()) |
router() |
CharterRouter (resolve(), fleetUrl(), yachtUrl(), categoryUrl(), destinationUrl()) |
normalizer() |
YachtNormalizer (beginBatch(), endBatch(), normalizeYachtForSave()) |
importer() |
CharterImporter (importFromDirectory()) |
notifier() |
CharterNotifier (notifyNewInquiry(), notifyOptionPlaced(), notifyExpiringHolds(), notifyHoldExpired()) |
workspace() |
CharterWorkspaceManager (nav counts, telemetry, collection exports) |
Hookable Methods (Charter & ProcessCharter)
Section titled “Hookable Methods (Charter & ProcessCharter)”| Hook | Arguments & Return | Timing | What It Does |
|---|---|---|---|
Charter::resolveBlueprint |
(string $type, array $definition): array |
After | Fires whenever CharterBlueprints registers one of the 26 charter-* schemas so projects can append custom yacht, booking, or inquiry fields. |
ProcessCharter::translations |
(): array |
After | Returns localized UI strings rendered inside the Setup -> Charter React workspace. |
Extend a Charter Blueprint & Customize Workspace Labels
Section titled “Extend a Charter Blueprint & Customize Workspace Labels”<?php
declare(strict_types=1);
namespace ProcessWire;
$wire->addHookAfter('Charter::resolveBlueprint', static function (HookEvent $event): void { if ($event->arguments(0) !== 'charter-yachts') { return; } $def = (array) $event->return; $def['fields']['imo_number'] = ['type' => 'text', 'label' => 'IMO Number']; $event->return = $def;});
$wire->addHookAfter('ProcessCharter::translations', static function (HookEvent $event): void { $strings = (array) $event->return; $strings['workspace.title'] = 'Aegean Fleet & Charters'; $event->return = $strings;});All 5 CLI Commands & Flags (vendor/bin/wire)
Section titled “All 5 CLI Commands & Flags (vendor/bin/wire)”1. charter:doctor
Section titled “1. charter:doctor”Validates all 26 schemas, Currency active rates, Contacts roles, and optional sibling integrations:
php vendor/bin/wire charter:doctor --jsonFlags: --json.
2. charter:expire-holds
Section titled “2. charter:expire-holds”Expires overdue Option bookings and optionally sends 24-hour expiring hold warnings:
php vendor/bin/wire charter:expire-holds --notify-expiring --dry-run --jsonFlags: --notify-expiring, --dry-run, --json.
3. charter:import
Section titled “3. charter:import”Imports structured JSON fleet catalogs, amenity pivots, and seasonal rates via CharterImporter:
php vendor/bin/wire charter:import --path=site/assets/imports/fleet --mode=upsert --limit=50 --offset=0 --skip-media --dry-run --force --jsonFlags: --path, --mode, --limit, --offset, --skip-media, --dry-run, --force, --json.
4. charter:scaffold:page
Section titled “4. charter:scaffold:page”Attaches composable @fieldset:charter-* embedded fields onto an existing ProcessWire template for Page-mode fleets:
php vendor/bin/wire charter:scaffold:page --template=yacht --sections=specs,cabins,amenities,rates,operations --prefix=charter_ --style=tabs --dry-run --jsonFlags: --template, --sections, --prefix, --style, --dry-run, --json.
5. charter:seed
Section titled “5. charter:seed”Seeds starter catalogs (CORE_GROUPS) and optional demo fleets/inquiries/bookings (DEMO_GROUPS):
php vendor/bin/wire charter:seed --mode=upsert --only=categories,destinations,marinas --with-demo --dry-run --force --jsonFlags: --mode, --only, --with-demo, --dry-run, --force, --json.
Scheduled Task (ExpireCharterHoldsTask)
Section titled “Scheduled Task (ExpireCharterHoldsTask)”schedule/ExpireCharterHoldsTask.php runs every 15 minutes (*/15 * * * *) via vendor/bin/wire schedule:run, calling $charter->expireOverdueHolds() and $charter->notifier()->notifyExpiringHolds().
Troubleshooting
Section titled “Troubleshooting”PricingEngine Throws a Missing FX Rate Exception
Section titled “PricingEngine Throws a Missing FX Rate Exception”Symptom: Calculating a USD quote on a EUR-priced yacht throws a WireException.
Fix: CurrencyConverter fails closed by design. Open Setup -> Currencies (or run php vendor/bin/wire currency:sync) to ensure active EUR/USD exchange rates exist.
Booking Save Fails With Availability Conflict or Lock Timeout
Section titled “Booking Save Fails With Availability Conflict or Lock Timeout”Symptom: Saving a booking fails with an overlap conflict or CharterWriteLock 5-second timeout.
Fix: Check Bookings & Calendar for active Option or Confirmed bookings overlapping [check_in, check_out) (expired holds are ignored automatically). If an option has expired, run php vendor/bin/wire charter:expire-holds.
Public Proposal Link Returns 404
Section titled “Public Proposal Link Returns 404”Symptom: Opening /_charter/proposal/{token} returns 404.
Fix: Confirm the token has not expired (ttlSeconds) and that the target inquiry/booking and referenced yacht are published and non-hidden (isLive() && !$isHidden).