API Models RelationReference - evansims/openfga-php GitHub Wiki

Represents a reference to a specific relation with optional conditions. A RelationReference identifies a relation within your authorization model, optionally with an associated condition that must be satisfied. This enables conditional relationships where the relation is only valid when certain runtime conditions are met. Use this when defining relation constraints or implementing attribute-based access control patterns in your authorization model.

Table of Contents


Namespace

OpenFGA\Models


Source

View source code


Implements


Related Classes


Constants

Name Value Description
OPENAPI_MODEL RelationReference


Methods

getCondition

public function getCondition(): ?string

Get the optional condition name that must be satisfied. When specified, this condition must evaluate to true for the relation reference to be valid. This enables conditional access based on runtime context and attributes.

View source


Returns

string | null — The condition name, or null if no condition is required


getRelation

public function getRelation(): ?string

Get the optional specific relation on the referenced type. When specified, this limits the reference to a specific relation on the target type rather than the entire type. This allows for more precise relationship definitions.

View source


Returns

string | null — The relation name, or null to reference the entire type


getType

public function getType(): string

Get the type being referenced. This is the object type that this reference points to. It defines which type of objects can be used in relationships through this reference.

View source


Returns

string — The type name being referenced


getWildcard

public function getWildcard(): ?object

Get the optional wildcard marker for type-level permissions. When present, this indicates that the reference applies to all instances of the specified type, rather than specific instances. This is useful for granting permissions at the type level.

View source


Returns

object | null — The wildcard marker, or null for instance-specific references


jsonSerialize

public function jsonSerialize(): array

View source


Returns

array


schema

Implements Models\RelationReferenceInterface

public function schema(): SchemaInterface

Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.

View source


Returns

SchemaInterface — The schema definition containing validation rules and property specifications for this model

⚠️ **GitHub.com Fallback** ⚠️