has_relations
trait has_relations
Trait has_relations.
Provides runtime relation support for Domain models. Relations are runtime-only objects loaded by Repositories/Loaders (Lazy Load or Eager Load). They are not persisted directly to the item table.
Methods
Property-style access: $item->parent.
Check presence of a relation.
Set a relation value.
Public accessor for relations using snake_case.
Returns TRUE if the relation was defined (even if value is null).
Get all currently loaded relations.
Details
at line 40
mixed
__get(string $name)
Property-style access: $item->parent.
Convenience wrapper for get_relation().
at line 52
bool
__isset(string $name)
Check presence of a relation.
at line 72
void
set_relation(string $name, mixed $value)
| internal |
Set a relation value.
INTERNAL API used by loader and the query engine. Use Repository/Loader to set these during hydration.
Architecture Note: This mutates the internal state of the entity. In a strict immutable context, this might return a clone, but for hydration performance (lazy loading relations), direct mutation is acceptable here.
at line 84
mixed
get_relation(string $name)
Public accessor for relations using snake_case.
at line 96
bool
has_relation(string $name)
Returns TRUE if the relation was defined (even if value is null).
at line 106
array
get_all_relations()
Get all currently loaded relations.