Methods |
public
static
|
getPlural(): ?string
Get the plural form of the entity's short name
Get the plural form of the entity's short name
If this method returns a value other than null or the unqualified name
of the entity, it may be used to identify provider methods that implement
sync operations on the entity.
For example, if Faculty::getPlural() returns null , a provider may
implement Faculty sync operations via one or more of the following:
create_faculty()
get_faculty()
update_faculty()
delete_faculty()
createList_faculty()
getList_faculty()
updateList_faculty()
deleteList_faculty()
If the same method returns "Faculties" , these are also recognised as
Faculty sync implementations:
createFaculty()
getFaculty()
updateFaculty()
deleteFaculty()
createFaculties()
getFaculties()
updateFaculties()
deleteFaculties()
Implements
|
#
|
public
static
|
getRelationships(): array
Get an array that maps properties to relationships
Get an array that maps properties to relationships
Implements
|
#
|
public
static
|
getDateProperties(): array
Get properties that accept date and time values
Get properties that accept date and time values
Date and time values are always converted to {@see DateTimeImmutable}
instances for declared and "magic" properties that accept
{@see DateTimeImmutable} and/or return {@see DateTimeInterface}. This
method may be used to nominate untyped properties for the same treatment.
If ["*"] is returned and the class has no declared or "magic"
properties with compatible type hints, date and time values are converted
to {@see DateTimeImmutable} instances for all properties.
Properties returned must accept {@see DateTimeImmutable} and/or return
{@see DateTimeInterface}.
Implements
|
#
|
public
static
|
flushStatic(): void
Reset static properties
|
#
|
public
|
getName(): string
Get the name of the object
Get the name of the object
Implements
|
#
|
protected
static
|
buildSerializeRules(SyncSerializeRulesBuilder<static> $rulesB): SyncSerializeRulesBuilder<static>
Override to specify how object graphs below entities of this type should
be serialized
Override to specify how object graphs below entities of this type should
be serialized
To prevent infinite recursion when entities of this type are serialized,
return a {@see SyncSerializeRulesBuilder} object configured to remove or
replace circular references.
|
#
|
protected
static
|
getRemovablePrefixes(): string[]|null
Override to specify prefixes to remove when normalising property names
Override to specify prefixes to remove when normalising property names
Entity names are removed by default, e.g. for an
{@see AbstractSyncEntity} subclass called User , "User" is removed to
ensure fields like "USER_ID" and "USER_NAME" match properties like "Id"
and "Name". For a subclass of User called AdminUser , both "User" and
"AdminUser" are removed.
Return null to suppress prefix removal, otherwise use
{@see AbstractSyncEntity::normalisePrefixes()} or
{@see AbstractSyncEntity::expandPrefixes()} to normalise the return
value.
|
#
|
final
public
|
getId()
Get the unique identifier of the object
Get the unique identifier of the object
Implements
|
#
|
final
public
|
getCanonicalId()
Get the unique identifier assigned to the entity by its canonical backend
Get the unique identifier assigned to the entity by its canonical backend
If a provider is bound to the service container as the default
implementation of the entity's underlying provider interface, it is
regarded as its canonical backend.
To improve the accuracy and performance of sync operations, providers
should propagate this value to and from backends capable of storing it.
Implements
|
#
|
final
public
static
|
getDefaultProvider(ContainerInterface $container): SyncProviderInterface
Get the entity's default provider
Get the entity's default provider
Implements
|
#
|
final
public
static
|
withDefaultProvider(ContainerInterface $container, ?SyncContextInterface $context = null): SyncEntityProviderInterface
Perform sync operations on the entity using its default provider
Perform sync operations on the entity using its default provider
Implements
|
#
|
final
public
static
|
getSerializeRules(): SyncSerializeRulesInterface
Get serialization rules
|
#
|
final
protected
static
|
getParentSerializeRules(): SyncSerializeRules<static>|null
Get the serialization rules of the entity's parent class
Get the serialization rules of the entity's parent class
|
#
|
final
public
static
|
normaliseProperty(string $name, bool $fromData = true, string ...$declaredName): string
Normalise a property name
Normalise a property name
$name is converted to snake_case
- If
$fromData is false or the result matches a $declaredName , it
is returned
- Otherwise, prefixes returned by {@see getRemovablePrefixes()} are
removed
Parameters
$fromData |
If true , $name is from data being applied to
the class, otherwise it is a trusted property or value name.
|
...$declaredName |
The names of any declared or "magic"
properties after normalisation. Not given if $fromData is false .
|
Implements
|
#
|
final
public
|
toArray(?SyncStoreInterface $store = null): array
Serialize the entity and any nested entities
Serialize the entity and any nested entities
Rules returned by {@see SyncEntityInterface::getSerializeRules()} are
used.
Implements
|
#
|
final
public
|
toArrayWith(SyncSerializeRulesInterface $rules, ?SyncStoreInterface $store = null): array
Use the given serialization rules to serialize the entity and any nested
entities
Use the given serialization rules to serialize the entity and any nested
entities
Implements
|
#
|
final
public
|
toLink(?SyncStoreInterface $store = null, int $type = LinkType::DEFAULT, bool $compact = true): array
Get the entity's canonical location in the form of an array
Get the entity's canonical location in the form of an array
Inspired by JSON-LD.
Implements
|
#
|
final
public
|
getUri(?SyncStoreInterface $store = null, bool $compact = true): string
Get the entity's canonical location in the form of a URI
Get the entity's canonical location in the form of a URI
Inspired by OData.
Implements
|
#
|
final
public
|
state(): int-mask-of<EntityState::*>
Get the current state of the entity
Get the current state of the entity
|
#
|
final
protected
static
|
normalisePrefixes(string[] $prefixes): string[]
Convert prefixes to snake_case for removal from property names
Convert prefixes to snake_case for removal from property names
e.g. ['AdminUserGroup'] becomes ['admin_user_group'] .
|
#
|
final
protected
static
|
expandPrefixes(string[] $prefixes): string[]
Convert prefixes to snake_case and expand them for removal from property
names
Convert prefixes to snake_case and expand them for removal from property
names
e.g. ['AdminUserGroup'] becomes ['admin_user_group', 'user_group', 'group'] .
|
#
|
final
public
static
|
provide(array $data, ProviderContextInterface $context)
Get an instance from an array on behalf of a provider
Get an instance from an array on behalf of a provider
Values in $data are applied as per {@see Constructible::construct()}.
Implements
|
#
|
final
public
static
|
provideMultiple(
iterable $data,
ProviderContextInterface $context,
int $conformity = Providable::CONFORMITY_NONE,
): iterable
Get instances from arrays on behalf of a provider
Get instances from arrays on behalf of a provider
Values in $data arrays are applied as per {@see provide()}.
Implements
|
#
|
final
public
static
|
idFromNameOrId(
$nameOrId,
$providerOrContext,
?float $uncertaintyThreshold = null,
?string $nameProperty = null,
?float &$uncertainty = null,
)
Resolve a name or entity ID to the entity ID of one matching entity
Resolve a name or entity ID to the entity ID of one matching entity
Returns:
null if $nameOrId is null
$nameOrId if it is a valid identifier for the entity in the given
provider (see {@see SyncProviderInterface::isValidIdentifier()}), or
- the entity ID of the entity to which
$nameOrId resolves
A {@see SyncEntityNotFoundExceptionInterface} is thrown if:
- there are no matching entities, or
- there are multiple matching entities
Implements
|
#
|
public
|
__serialize(): array<string, mixed>
|
#
|
public
|
__unserialize(array<string, mixed> $data): void
|
#
|