API Models ObjectRelation - evansims/openfga-php GitHub Wiki

Represents a reference to a specific relation on an object. In authorization models, you often need to reference relationships between objects. An ObjectRelation identifies both the target object and the specific relation you're interested in, like "the owner of document:budget" or "editors of folder:reports." This is commonly used in authorization rules where permissions depend on relationships with other objects in your system.

Table of Contents


Namespace

OpenFGA\Models


Source

View source code


Implements


Related Classes


Constants

Name Value Description
OPENAPI_MODEL ObjectRelation


Methods

getObject

public function getObject(): ?string

Get the object identifier in an object-relation pair. The object represents the resource or entity being referenced, typically formatted as "type:id" where type describes the kind of resource.

View source


Returns

string | null


getRelation

public function getRelation(): string

Get the relation name that defines the type of relationship to the object. The relation describes what kind of permission or relationship exists. Common examples include "owner," "viewer," "editor," "member."

View source


Returns

string — The non-empty relation name


jsonSerialize

public function jsonSerialize(): array

View source


Returns

array


schema

Implements Models\ObjectRelationInterface

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** ⚠️