Skip to content

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”
site/ready.php
<?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)”

Validates all 26 schemas, Currency active rates, Contacts roles, and optional sibling integrations:

Terminal window
php vendor/bin/wire charter:doctor --json

Flags: --json.

Expires overdue Option bookings and optionally sends 24-hour expiring hold warnings:

Terminal window
php vendor/bin/wire charter:expire-holds --notify-expiring --dry-run --json

Flags: --notify-expiring, --dry-run, --json.

Imports structured JSON fleet catalogs, amenity pivots, and seasonal rates via CharterImporter:

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

Flags: --path, --mode, --limit, --offset, --skip-media, --dry-run, --force, --json.

Attaches composable @fieldset:charter-* embedded fields onto an existing ProcessWire template for Page-mode fleets:

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

Flags: --template, --sections, --prefix, --style, --dry-run, --json.

Seeds starter catalogs (CORE_GROUPS) and optional demo fleets/inquiries/bookings (DEMO_GROUPS):

Terminal window
php vendor/bin/wire charter:seed --mode=upsert --only=categories,destinations,marinas --with-demo --dry-run --force --json

Flags: --mode, --only, --with-demo, --dry-run, --force, --json.

schedule/ExpireCharterHoldsTask.php runs every 15 minutes (*/15 * * * *) via vendor/bin/wire schedule:run, calling $charter->expireOverdueHolds() and $charter->notifier()->notifyExpiringHolds().

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.

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).

Next steps