The Relationship class represents a relationship between two models in the ORM system.
Public fields
local_modelThe model that owns the relationship.
local_keyThe key in the local model that relates to the foreign key in the related model.
related_modelThe model that is being related to.
related_keyThe key in the related model that the local_key relates to.
typeThe type of relationship (one_to_one, one_to_many, many_to_many, or many_to_one).
Methods
Method new()
Create a new Relationship object.
Usage
Relationship$new(
local_model,
local_key,
type = c("one_to_one", "one_to_many", "many_to_many", "many_to_one"),
related_model,
related_key
)Arguments
local_modelThe model that owns the relationship.
local_keyThe key in the local model that relates to the foreign key in the related model.
typeThe type of relationship.
related_modelThe model that is being related to.
related_keyThe key in the related model that the local_key relates to.
Method print()
Print a human-readable representation of the relationship.