CoolCMS API

Identity
in package

FinalYes

Marks a property that is part of the entity identity (primary key) for {@see \App\Core\Utils\Hydrators\EntityHydrator}.

The module hydrator builds the {id: ...} reference keys from it. It works on a scalar (languageId) and on an association (derived identity, where the PK comes from the parent, e.g. the *Text family). Without any #[Identity] the hydrator falls back to the property named id, so annotate only composite or derived identities.

Usage:

#[Identity]
protected int $languageId;
Attributes
#[Attribute]
\Attribute::TARGET_PROPERTY

Table of Contents

On this page
  • Table Of Contents

Search results