AbstractRelationship
class AbstractRelationship implements InterfaceRelationship (View source)
Abstract class that all relationships must extend from.
Properties
string | $attribute_name | Name to be used that will trigger call to the relationship. | |
string | $class_name | Class name of the associated model. | |
string | $foreign_key | Name of the foreign key. | |
protected array | $options | Options of the relationship. | |
protected boolean | $poly_relationship | Is the relationship single or multi. | |
static protected array | $valid_association_options | List of valid options for relationships. |
Methods
Constructs a relationship.
No description
What is this relationship's cardinality?
Eagerly loads relationships for $models.
Creates a new instance of specified {@link Model} with the attributes pre-loaded.
Creates a new instance of {@link Model} and invokes save.
No description
No description
Infers the $this->class_name based on $this->attribute_name.
No description
No description
Creates INNER JOIN SQL for associations.
Details
at line 75
__construct($options = array())
Constructs a relationship.
at line 99
protected
get_table()
at line 109
bool
is_poly()
What is this relationship's cardinality?
at line 129
protected void
query_and_attach_related_models_eagerly(Table $table, $models, $attributes, $includes = array(), $query_keys = array(), $model_values_keys = array())
Eagerly loads relationships for $models.
This method takes an array of models, collects PK or FK (whichever is needed for relationship), then queries the related table by PK/FK and attaches the array of returned relationships to the appropriately named relationship on $models.
at line 222
build_association(Model $model, $attributes = array(), $guard_attributes = true)
Creates a new instance of specified {@link Model} with the attributes pre-loaded.
at line 235
create_association(Model $model, $attributes = array(), $guard_attributes = true)
Creates a new instance of {@link Model} and invokes save.
at line 254
protected
merge_association_options($options)
at line 265
protected
unset_non_finder_options($options)
at line 283
protected void
set_inferred_class_name()
Infers the $this->class_name based on $this->attribute_name.
Will try to guess the appropriate class by singularizing and uppercasing $this->attribute_name.