Oihana PHP System

hydrateAppointment.php

Table of Contents

Functions

hydrateAppointment()  : mixed
Hydrate an array definition with the Appointment class, or with a subclass of it.

Functions

hydrateAppointment()

Hydrate an array definition with the Appointment class, or with a subclass of it.

hydrateAppointment([mixed $init = null ][, DefinedTerm>|array<string, DefinedTerm>|array<string, DefinedTerm>>> $termClass = ThesaurusTerm::class ][, Appointment> $class = Appointment::class ]) : mixed

Handles both a single appointment array and an array of appointments.

What it resolves is everything a meeting may carry, and every polymorphic case is settled by the stored type of the value itself — never by a class this helper would impose :

  • eventStatus and appointmentStatus — the two axes of state, each read back as the member class holding its URI ;
  • appointmentType and tags — the vocabularies of the meeting itself ;
  • about — the counterpart : a value announcing a customer is read back as one, and anything else falls back on its @type, an organization or a person ;
  • attendee — entry by entry : an account, a customer contact, or a plain person or organization — one table may seat them together ;
  • makesOffer — what one means to put in front of the counterpart ;
  • report — by its stored type : a visit's write-up comes back with its richer class, any other with the common one, each resolved in depth by its own helper.

The diary (organizer) needs no resolver : its attribute says enough for reflection to answer it.

🔑 The target class is a parameter, so a caller with a subclass of its own reuses this whole body rather than copying it.

Parameters
$init : mixed = null

Single appointment data or array of appointment data.

$termClass : DefinedTerm>|array<string, DefinedTerm>|array<string, DefinedTerm>>> = ThesaurusTerm::class

The class the term properties are hydrated into, or a map naming them one by one. See termClassOf().

$class : Appointment> = Appointment::class

The class to build — a subclass of Appointment, or itself.

Tags
throws
HydrationException
ReflectionException
example
$meeting = hydrateAppointment
([
    'startDate'         => '2035-09-01T10:00:00+02:00' ,
    'appointmentStatus' => 'https://schema.oihana.xyz/AppointmentPlanned' ,
    'appointmentType'   => [ 'id' => 'CALL' ] ,
]);

$meeting->appointmentType instanceof ThesaurusTerm ; // true
On this page

Search results