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
OpenFGA\Models
RelationReferenceInterface
JsonSerializable
ModelInterface
- RelationReferenceInterface (interface)
- RelationReferences (collection)
Name | Value | Description |
---|---|---|
OPENAPI_MODEL |
RelationReference |
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.
string
| null
— The condition name, or null if no condition is required
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.
string
| null
— The relation name, or null to reference the entire type
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.
string
— The type name being referenced
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.
object
| null
— The wildcard marker, or null for instance-specific references
public function jsonSerialize(): array
array
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.
SchemaInterface
— The schema definition containing validation rules and property specifications for this model